Docker port mapping is a bit covered. Who can explain it?

  docker, question

Docker port mapping is a bit covered. Who can explain it?

Mutual access between containers needs to use the –link parameter when creating containers, and the containers that are best connected have already been named.

docker run --name mysql .......
docker run --name php --link mysql .......
docker run --name nginx --link php .......

When starting in this way, you only need to use the corresponding container name in the program to access the corresponding service.
For examplefastcgi_pass php:9000;

If the port is exposed to the outside, it needs to pass the -p or -P parameter, and it is better to use-p.
docker run --name nginx -p 80:80 -p 443:443 .......
In this way, the browser can access the Web services provided by this server.