Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Dockerfile deployment Nginx1.9.7 image

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report