zoukankan      html  css  js  c++  java
  • Docker Networks 笔记

    Docker Networks

    Bridge Networks
    The Docker bridge driver automatically installs rules in the host machine so that containers on different bridge networks cannot communicate directly with each other.
    Bridge networks apply to containers running on the same Docker daemon host. For communication among containers running on different Docker daemon hosts, you can either manage routing at the OS level, or you can use an overlay network.
    The default bridge network is considered a legacy detail of Docker and is not recommended for production use. Configuring it is a manual operation, and it has technical shortcomings.
    User-defined bridge networks are best when you need multiple containers to communicate on the same Docker host.
     
    Overlay Networks
    Overlay networks are best when you need containers running on different Docker hosts to communicate, or when multiple applications work together using swarm services.
    When you initialize a swarm or join a Docker host to an existing swarm, two new networks are created on that Docker host:
    An overlay network called ingress, which handles control and data traffic related to swarm services. When you create a swarm service and do not connect it to a user-defined overlay network, it connects to the ingress network by default.
    A bridge network called docker_gwbridge, which connects the individual Docker daemon to the other daemons participating in the swarm.
    Containers can be connected to more than one network at a time. Containers can only communicate across networks they are each connected to.
    The ingress network is created without the --attachable flag, which means that only swarm services can use it, and not standalone containers. You can connect standalone containers to user-defined overlay networks which are created with the --attachable flag. This gives standalone containers running on different Docker daemons the ability to communicate without the need to set up routing on the individual Docker daemon hosts.
    Container discovery
    For most situations, you should connect to the service name, which is load-balanced and handled by all containers (“tasks”) backing the service. To get a list of all tasks backing the service, do a DNS lookup for tasks.<service-name>.
     
    Host Networks
    Host networks are best when the network stack should not be isolated from the Docker host, but you want other aspects of the container to be isolated.
    If you use the host network mode for a container, that container’s network stack is not isolated from the Docker host (the container shares the host’s networking namespace), and the container does not get its own IP-address allocated. For instance, if you run a container which binds to port 80 and you use host networking, the container’s application is available on port 80 on the host’s IP address.
    Note: Given that the container does not have its own IP-address when using host mode networking, port-mapping does not take effect, and the -p, --publish, -P, and --publish-all option are ignored, producing a warning instead:
    WARNING: Published ports are discarded when using host network mode
    Host mode networking can be useful to optimize performance, as it does not require network address translation (NAT).
    The host networking driver only works on Linux hosts, and is not supported on Docker Desktop for Mac, Docker Desktop for Windows, or Docker EE for Windows Server.
     
     
     
     
  • 相关阅读:
    使用C# impersonation进行windows帐号的校验
    今天,如何将你现有的网站移动互联网化【译】
    吐槽一下拖延的生活状态
    Web前端开发工程师编程能力飞升之路【转】
    公司框架集成log4net时遇到的问题
    我所认知的电子商务解决方案
    Web开发攻城狮,欲善其事先利其器
    调用Web Service服务出现响应消息的内容类型text/html与绑定text/xml的内容类型不匹配
    服务器 '***' 上的 MSDTC 不可用
    Firefox中无法使用window.close()关闭窗口
  • 原文地址:https://www.cnblogs.com/andycja/p/14018949.html
Copyright © 2011-2022 走看看