Dockerfile文件内容如下:
FROM centos7base:7.3.1611
MAINTAINER yushibo <shihuan830619@163.com>
RUN yum install -y gcc gcc-c++
RUN yum install -y unzip zip
RUN yum install -y m4
RUN yum install -y perl
RUN yum install -y perl-Test-Harness
RUN yum install -y
autoconf
automake libtool make
COPY nginx-1.11.12.tar.gz apr-1.5.2.tar.gz apr-iconv-1.2.1.tar.gz zlib-1.2.8.tar.gz pcre-8.38.zip openssl-1.0.2i.tar.gz openssl-1.1.0b.tar.gz /usr/local/src/
WORKDIR /usr/local/src
RUN tar -zxf nginx-1.11.12.tar.gz
RUN tar -zxf apr-1.5.2.tar.gz
RUN tar -zxf apr-iconv-1.2.1.tar.gz
RUN tar -xf zlib-1.2.8.tar.gz
RUN tar -zxf openssl-1.1.0b.tar.gz
RUN unzip -d /usr/local/src pcre-8.38.zip
WORKDIR /usr/local/src/pcre-8.38
RUN ./configure --prefix=/usr/local/pcre && make && make install
WORKDIR /usr/local/src/zlib-1.2.8
RUN ./configure --prefix=/usr/local/zlib && make && make install
WORKDIR /usr/local/src/openssl-1.1.0b
RUN ./config --prefix=/usr/local/openssl && make && make install
RUN groupadd nginx
RUN useradd -g nginx nginx
RUN echo "nginx" | passwd --stdin nginx
WORKDIR /usr/local/src/nginx-1.11.12
RUN ./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --error-log-path=/usr/local/nginx/logs/error/error.log --pid-path=/usr/local/nginx/logs/nginx.pid --user=nginx --group=nginx --http-log-path=/usr/local/nginx/logs/httpd.log --http-client-body-temp-path=/usr/local/nginx/temp/http-client-body-temp --http-proxy-temp-path=/usr/local/nginx/temp/http-proxy-temp --without-http_fastcgi_module --http-uwsgi-temp-path=/usr/local/nginx/temp/http-uwsgi-temp --http-scgi-temp-path=/usr/local/nginx/temp/http-scgi-temp --with-pcre=/usr/local/src/pcre-8.38 --with-zlib=/usr/local/src/zlib-1.2.8 --with-openssl=/usr/local/src/openssl-1.1.0b --with-http_stub_status_module --without-http_memcached_module --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module && make && make install
RUN mkdir -p /usr/local/nginx/temp/http-client-body-temp
RUN sed -i 's/listen 80;/listen 10080;/' /usr/local/nginx/conf/nginx.conf
RUN sed -i 's/server_name localhost;/server_name 192.168.10.113;/' /usr/local/nginx/conf/nginx.conf
VOLUME ["/usr/local/nginx/"]
RUN sed -i '3a daemon off;' /usr/local/nginx/conf/nginx.conf
RUN sed -i '4a master_process off;' /usr/local/nginx/conf/nginx.conf
RUN sed -i 's/^#error_log logs\/error.log\/error_log logs/error.log/' /usr/local/nginx/conf/nginx.conf
ENV NGINX_HOME /usr/local/nginx
EXPOSE 10080
RUN /usr/local/nginx/sbin/nginx -t
CMD ["/usr/local/nginx/sbin/nginx"]
执行
dockerbuild -t shihuan/nginx1.11.12:1.0 -f /opt/nginxtra/Dockerfile .命令后返回成功结果。
再执行
docker run –d -p 10080:10080 --name docker_nginx1.11.12 –it shihuan/nginx1.11.12:1.0命令后也没什么错误信息。
执行
docker logs container_id也没有任何信息。
执行
docker ps命令显示没有运行状态的container。
执行
docker ps -l命令显示刚刚执行的
docker_nginx1.11.12这个容器的port是空的,也就是说容器没有正常的被启动,nginx方面也没有任何信息,
请问我该怎么诊断这个问题?