1.随机映射 docker run -P -d --name mynginx1 nginx [root@node1 ~]# docker ps -l CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 602397858dca nginx "nginx -g 'daemon of 19 seconds ago Up 17 seconds 0.0.0.0:32769->80/tcp, 0.0.0.0:32768->443/tcp
端口映射 容器运行时如果没有指定端口,与外界是无法通信的,比如当前我们的有一台MySQL的docker container,当前容器正在运行mysql并提供3306端口 # docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 2e54153e56ca mysql:version1 " days ago Up About a minute mysql-new-container # docker " tcp6 :