1. 新建Dockerfile
-
FROM centos
-
RUN yum install -y gcc gcc-c++ make cmake zlib-devel pcre-devel openssl-devel ncurses-devel bison bison-devel unzip expect openssh-clients perl vim lsof wget
-
RUN /usr/bin/wget -P /usr/local/src
-
RUN cd /usr/local/src/ \
-
&& tar xf tengine-2.1.2.tar.gz \
-
&& cd tengine-2.1.2 \
-
&& ./configure --prefix=/etc/nginx --user=nginx --group=nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module \
-
&& make && make install \
-
&& mkdir -p /var/cache/nginx/client_temp \
-
&& sed -i 's/#user nobody;/user nobody;/g' /etc/nginx/nginx.conf \
-
&& sed -i '10 idaemon off;' /etc/nginx/nginx.conf
-
EXPOSE 22
-
EXPOSE 80
-
CMD ["/usr/sbin/nginx"]
2. docker build zhouhe_nginx/v3.0 .
3. docker run -d --name web zhouhe_nginx/v3.0
顺便记录几条常用的docker命令
杀死所有正在运行的容器
# docker kill $(docker ps -a -q)
删除停止的容器
# docker rm $(docker ps -a -q)
删除所有未打 dangling 标签的镜像
docker rmi $(docker images -q -f dangling=true)
删除所有镜像
docker rmi $(docker images -q)
阅读(1251) | 评论(0) | 转发(0) |