050、建立overlay網路(2019-03-15 週五)

三角形發表於2019-03-15
 
在host01中建立overlay網路 ov_net1
 
在下面的例子中可以看到,我們在host01上建立的overlay型別網路,會自動出現在host02上,該網路的name、id、IPAM都一樣
 
這是因為host01將ov_net1的資訊存到了consul中,host02從consul讀取到了新建立的網路,自動同步到host02上
 
IPAM(IP Address Management)
 
root@host01:~# docker network create -d overlay ov_net1
609020e03ff4ac5fb1aad73e23bfb22bc288463663e5aba775ed06263077c242
root@host01:~# docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
5f1cb3e7ea16        bridge              bridge              local
a08d5e1df638        host                host                local
83f08e15caa8        none                null                local
609020e03ff4        ov_net1             overlay             global
root@host01:~# docker network inspect ov_net1
[
    {
        "Name": "ov_net1",
        "Id": "609020e03ff4ac5fb1aad73e23bfb22bc288463663e5aba775ed06263077c242",
        "Created": "2019-03-15T08:52:44.452192114+08:00",
        "Scope": "global",
        "Driver": "overlay",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "10.0.0.0/24",
                    "Gateway": "10.0.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {},
        "Labels": {}
    }
]
 
-----------------------------------------------------------------------------------------
 
root@host02:~# docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
6e2bde8f59ac        bridge              bridge              local
54f47d6227e5        host                host                local
042431e6b445        none                null                local
609020e03ff4        ov_net1             overlay             global
root@host02:~# docker network inspect ov_net1
[
    {
        "Name": "ov_net1",
        "Id": "609020e03ff4ac5fb1aad73e23bfb22bc288463663e5aba775ed06263077c242",
        "Created": "2019-03-15T08:52:44.452192114+08:00",
        "Scope": "global",
        "Driver": "overlay",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "10.0.0.0/24",
                    "Gateway": "10.0.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {},
        "Labels": {}
    }
]
 
 

相關文章