(Docker notes): Practice deployment of nginx and access test

table of Contents

①Search mirror

②Download the mirror

③Start nginx

**Alibaba Cloud port opening settings

④Visit nginx through the browser


①Search mirror

docker search nginx

②Download the mirror

docker pull nginx

③Start nginx

  • Pay attention to setting the exposed port
    • -d run in the background
    • --name name the container
    • -p host port: internal port of the container
docker run -d --name=nginx01 -p 3344:80 nginx

  • test:
curl localhost:3344

  • Schematic diagram of port exposure

**Alibaba Cloud port opening settings

④Visit nginx through the browser

  • Browser can be accessed through port 3344

  • Modify nginx configuration file

  • Question : Does every time I change the nginx configuration file, do I need to enter the container to make changes? Wouldn't it be very troublesome, if you can provide a mapping path outside the container, and modify the file outside the container, the inside of the container can be automatically modified, which is very convenient. This is the volume technique to learn later.

Guess you like

Origin blog.csdn.net/baidu_41388533/article/details/108540051