zoukankan      html  css  js  c++  java
  • 《Docker技术入门与实践》Docker入门3-网络基础配置

    7.1 端口映射实现访问容器

    docker run -P    会随机分配一个端口暴露给主机, -p 可以指定一个端口
        
    
      -p, --publish list                          Publish a container's port(s) to the host (default [])
      -P, --publish-all                           Publish all exposed ports to random ports
    
        
    
    docker port 查看端口映射
    

    在这里插入图片描述

    7.2 容器互联实现容器间通信

    --link name:alias  让 当前容器hosts中添加 另一容器的地址  。反过来不行,因为先后启动。
    

    在这里插入图片描述
    在这里插入图片描述
    能直接ping通ng
    是因为 在hosts中设置了 ng的地址
    在这里插入图片描述
    在这里插入图片描述
    不能从ng到ng2

    在这里插入图片描述

  • 相关阅读:
    py 5.11
    py 5.10
    py 5.9
    py 5.8
    python 5.7
    python 5.4
    python 5.3
    python 5.2
    python 4.28
    python 4.27
  • 原文地址:https://www.cnblogs.com/thewindkee/p/12873145.html
Copyright © 2011-2022 走看看