摘要:
Dockerfile:[root@node1 nginx]# cat Dockerfile FROM mycentos6u8...
Dockerfile:
[root@node1 nginx]# cat Dockerfile FROM mycentos6u8 RUN yum install -y nginx RUN sed -i '/^user/i\daemon off;' /etc/nginx/nginx.conf ADD index.html /usr/share/nginx/html/index.html EXPOSE 80 ENTRYPOINT ["nginx"]
构建:
[root@node1 nginx]# cat docker-build.sh #!/bin/bash docker build -t nginx02 . [root@node1 nginx]# echo "nginx02">index.html
运行测试:
[root@node1 nginx]# docker run -d --rm --name nginx02 -p8082:80 nginx02 e3a169419f6b2094876f85859e8a953062b9d0f12c0b61b1e633b99629dca354 [root@node1 nginx]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e3a169419f6b nginx02 "nginx" 3 seconds ago Up 2 seconds 0.0.0.0:8082->80/tcp nginx02 4aa48a82039a e54faac158ff "/bin/bash" 9 hours ago Up 9 hours centos6u8 [root@node1 nginx]# curl http://127.0.0.1:8082/ nginx02
还没有评论,来说两句吧...