无法从网络断开Docker容器

时间:2016-11-16 06:04:25

标签: networking docker

尝试断开连接到网络(NetworkA)的Docker容器(ContainerA1),但即使使用--force标记也无法这样做。

$ docker network disconnect NetworkA ContainerA1

我收到错误回复:container c5d345a09c6d is not connected to the network。 (为简洁起见,修剪了容器ID)。

奇怪的是,我能够从NetworkA断开其他容器

我使用docker network inspect NetworkA检查了网络。我明白了:

[
    {
        "Name": "NetworkA",
        "Id": "9e4895ee72a1648ad10f297357447529b277beb92fe21069a244a8265b8f7306",
        "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": {
            "aded6369aef63b5237a7f543333f0b7fafbe2f01496efb2012bb7f5d67f14268": {
                "Name": "ContainerA2",
                "EndpointID": "c93b9dde46884181ca5acb63c03b2fb5fb3141e98416dda3e6cbc98b166b88ee",
                "MacAddress": "02:42:ac:12:00:03",
                "IPv4Address": "172.18.0.3/16",
                "IPv6Address": ""
            },
            "ep-0f7d832a8d0cd86d8655ea9e0c1f7bbf33f1102b7bbe6454aca1ab8a48a6e4cd": {
                "Name": "ContainerA1",
                "EndpointID": "0f7d832a8d0cd86d8655ea9e0c1f7bbf33f1102b7bbe6454aca1ab8a48a6e4cd",
                "MacAddress": "02:42:ac:12:00:07",
                "IPv4Address": "172.18.0.7/16",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {}
    }
]

注意ContainerA1的ep-前缀。

我尝试删除容器,但在docker network inspect NetworkA时仍然会在容器列表中看到它。 “EndpointID”与容器ID不同,但具有相同的名称。

如何从网络中删除过时的条目,NetworkA?

0 个答案:

没有答案