050、创建overlay网络(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": {}
    }
]
 
 
posted @ 2019-03-15 09:02  三角形  阅读(131)  评论(0编辑  收藏  举报