1. 程式人生 > 其它 >docker安裝並部署nginx

docker安裝並部署nginx

安裝nginx映象

docker pull nginx

建立並後臺執行nginx容器,命名為nginx01,指定主機和容器埠之間的對映

docker run -d --name nginx01 -p 3344:80 nginx

本機自測

[root@iZmu0fa4hv0jwzZ home]# docker ps
CONTAINER ID   IMAGE     COMMAND                  CREATED         STATUS         PORTS                                   NAMES
03ae4ad1999f   nginx     
"/docker-entrypoint.…" 5 seconds ago Up 3 seconds 0.0.0.0:3344->80/tcp, :::3344->80/tcp nginx01 [root@iZmu0fa4hv0jwzZ home]# curl localhost:3344 <!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> <style> body { width: 35em; margin:
0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } </style> </head> <body> <h1>Welcome to nginx!</h1> <p>If you see this page, the nginx web server is successfully installed and working. Further configuration is required.</p> <p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/> Commercial support is available at <a href="http://nginx.com/">nginx.com</a>.</p> <p><em>Thank you for using nginx.</em></p> </body> </html>

可以看見welcome to nginx

埠暴露的概念