Docker Community Forums

Share and learn in the Docker community.

Dockerfile nginx-naxsi compile got returned a non-zero code 127


#1

could someone help me please, i got some problem today when create Dockerfile, iam new with docker… i want to create Nginx-naxsi in docker… but i got some error…

here my Dockerfile

i always got error returned a non-zero code : 127
please i need help sir

FROM centos:centos7
ENV NGINX_VERSION=1.15.8
# Install prerequisites for Nginx compile
RUN yum install -y \
    wget \
    tar \
    openssl-devel \
    gcc \
    gcc-c++ \
    make \
    zlib-devel \
    pcre-devel \
    gd-devel \
    krb5-devel \
    git
	
# Download Nginx and Nginx modules source
RUN     cd /tmp && \
    wget http://nginx.org/download/nginx-1.15.8.tar.gz -O nginx.tar.gz && \
    wget https://github.com/nbs-system/naxsi/archive/0.56.tar.gz -O naxsi.tar.gz && \
    mkdir /usr/local/naxsi && \
    tar -xzvf naxsi.tar.gz && \
    rm naxsi.tar.gz && \
    mv naxsi-0.56/ /usr/local/naxsi && \
    mkdir /usr/local/nginx && \
    tar -xzvf nginx.tar.gz && \
    rm nginx.tar.gz && \

# Compile Nginx with Naxsi
RUN     cd /tmp/nginx-1.15.8 && \
    ./configure \
    --user=nginx \
    --conf-path=/usr/local/nginx/conf/nginx.conf \
    --add-module=/usr/local/naxsi/naxsi_src/ \
    --error-log-path=/var/log/nginx/error.log \
    --http-log-path=/var/log/nginx/access.log \
    --http-client-body-temp-path=/usr/local/nginx/body \
    --http-fastcgi-temp-path=/usr/local/nginx/fastcgi \
    --http-uwsgi-temp-path=/usr/local/nginx/uwsgi \
    --http-scgi-temp-path=/usr/local/nginx/scgi \
    --http-proxy-temp-path=/usr/local/nginx/proxy \
    --lock-path=/var/run/nginx.lock \
    --pid-path=/var/run/nginx.pid \
    --with-http_ssl_module \
    --with-http_addition_module \
    --with-http_realip_module \
    --with-http_geoip_module \
    --with-http_gunzip_module \
    --without-mail_pop3_module \
    --without-mail_smtp_module \
    --without-mail_imap_module \
    --without-http_uwsgi_module \
    --without-http_scgi_module \
    --with-ipv6 \
    --sbin-path=/usr/sbin/nginx \
    --prefix=/usr/local/nginx \
  make && make install && \

# Add nginx user
RUN useradd --system --home /var/cache/nginx --shell /sbin/nologin --comment "nginx user" --user-group nginx \
RUN touch /var/run/nginx.pid
RUN chown nginx:nginx /usr/local/nginx/ /usr/local/nginx/conf /usr/local/nginx/body 
/usr/local/nginx/conf/nginx.conf /var/log/nginx /var/run/nginx.pid

# Cleanup after Nginx build
RUN yum remove -y \
    wget \
    tar \
    gcc \
    gcc-c++ \
    make \
    git && \
yum autoremove -y && \
rm -rf /tmp/*

# PORTS
EXPOSE 80
EXPOSE 443
USER nginx
CMD ["/usr/sbin/nginx", "-g", "daemon off;"]