Dockerfile deployment Nginx1.9.7 image
Full step: [root@localhost ~] # yum install yum-utils device-mapper-persistent-data lvm2-y [root@localhost ~] # yum-config-manager-- add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo[root@localhost ~] # yum install-y docker-ce [root@localhost ~] # systemctl stop firewalld.service [root@localhost ~] # setenforce 0 [root@localhost ~] # systemctl start docker.service [root@localhost ~] # Systemctl enable docker.service [root@localhost ~] # tee / etc/docker/daemon.json / usr/local/nginx/conf/nginx.confWORKDIR / root/nginx# add run.sh from the host to the container ADD run.sh / run.shRUN chmod 755 / run.shCMD ["/ run.sh"] [root@localhost nginx] # vim run.shrun.shrun.run.sh to create a new image [root@localhost nginx] # docker build-t nginx:new . # launch the container for testing [root@localhost nginx] # docker run-d-P nginx:new1e42f3a46caf349a964c4304b900ecb406102e3dc7e5beae16293f071470e54b [root@localhost nginx] # docker ps-aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES1e42f3a46caf nginx:new "/ run.sh" 8 seconds ago Up 7 seconds 0.0.0.0 80/tcp 32769-> 0.0.0.0IP 32768-> 443/tcp hardcore_cerf authentication: return to port 32769 where the host accesses CentOS's IP address in the browser See if you can visit the Nginx home page.