• 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.
     
     
     
     
  • 相关阅读:
    MySQL:Mysql字符串截取函数SUBSTRING的用法说明
    windows2003+iis6.0+php(fastcgi)5.3+wincache+memcached
    apache 80端口未被占用,启动不了的问题
    服务器端口大全
    UCenter 表结构
    “来自客户端名 a 的远程会话超出了所允许的失败登录最大次数。强行终止了会话。”原因及解决方法
    开发云应用从何入手?
    Building Nutch: Open Source Search
    Nutch0.9加入ICTCLAS 支持中文分词等(转)
    OWL解惑 :AllValuesFrom与Range的区别 关于Domain和Range
  • 原文地址:https://www.cnblogs.com/andycja/p/14018949.html
Copyright © 2020-2023  润新知