Docker Network Configuration (iii) __cloud

Source: Internet
Author: User
Tags docker run
Docker Network Management Network Related commands
Docker Network Create  #自定义网络
Docker Network Connect #连接完了
Docker network ls   #查看网络列表
Docker Network RM   #移除网络
Docker network disconnect  #断开完了
Docker network inspect  #查看网络详细信息
Default Network

Docker installation is done by default create 3 network, can listen to song Docker network LS (version in 1.9 and above) command view.

$ docker Network LS
network ID          NAME                DRIVER
7fca4eb8c647
Bridge 9f904ee27bf5        none                null
CF03EE007FB4        host                Host

Bridge is the default container network in the system only for DOCKER0 (which can be viewed via ifconfig or IP addr), the default boot container is connected to the DOCKER0, you can restart the container is through the –net parameter Docker run--net =<network> Specifies that the container is connected to the network.

None means that the container does not have network functionality, and when you connect to the container (example: Docker exec-it Container_name/bin/bash) You cannot see the other network adapters through Ifconfig or IP addr. Only the local loopback network.

host when using the hosts network, container will use the mainframe's network stack.

View network details Docker network inspect bridge, you can view all the network details listed in LS by inspect.

$ docker Network inspect bridge
[
   {
       ' Name ': ' Bridge ',
       ' Id ': ' f7ab26d71dbd6f557852c7156ae0574bbf62c42f539b50c8ebde0f728a253b6f ","
       Scope ":" Local ",
       " Driver ":" Bridge ",
       "IPAM": {"
           Driver": "Default",
           "Config": [
               {
                   "Subnet": "172.17.0.1/16",
                   "Gateway": " 172.17.0.1 "
               }
           ]
       },
       " containers ": {},
       " Options ": {
           " Com.docker.network.bridge.default_bridge ": True",
           "COM.DOCKER.NETWORK.BRIDGE.ENABLE_ICC": "True",
           " Com.docker.network.bridge.enable_ip_masquerade ": True",
           "Com.docker.network.bridge.host_binding_ipv4": " 0.0.0.0 ",
           " Com.docker.network.bridge.name ":" Docker0 ",
           " COM.DOCKER.NETWORK.DRIVER.MTU ":" 9001 "
       }
   }
]
This is not a detailed description of all the parameters, the basic view can be understood in the ' container ' parameter content is the container information belonging to this network.
Custom Network

Creating a custom network is simple Docker network create--driver Bridge Mnet, create a bridge network called Mnet,

$ docker Network Inspect Mnet
[
    {
        ' Name ': ' Mnet ',
        ' Id ': ' 50650309e0813bdad175b6c486168a3cdbcdc171adde3b21428c262943f5221b ","
        Scope ":" Local ",
        " Driver ":" Bridge ",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "Default",
            "Options": {},
            "Config": [
                {
                    ] Subnet ":" 172.18.0.0/16 ","
                    Gateway ":" 172.18.0.1/16 "
                }
            ]
        },
        " Internal ": false,
        " Containers ": {}, '
        options ': {},
        ' Labels ': {}
    }
]

Note The custom network does not support link. Multi-Host network

Docker multiple host networks rely on distributed storage systems and Docker LIBKV libraries. Not in the back.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.