我有码头网络“my_network”。我想删除这个 docker 网络docker network rm my_network
。在此之前,我应该断开所有容器与该网络的连接。我可以使用docker network inspect
并获得类似的输出
[
{
"Name": "my_network",
"Id": "aaaaaa",
"Scope": "some_value",
"Driver": "another_value",
"EnableIPv6": bool_value,
"IPAM": {
"Driver": "default",
"Options": {},
"Config": [
{
"Subnet": "10.0.0.0/1"
}
]
},
"Internal": false,
"Containers": {
"bbb": {
"Name": "my_container_1",
"EndpointID": "ENDPOITID1",
"MacAddress": "MacAddress1",
"IPv4Address": "0.0.0.0/1",
"IPv6Address": ""
},
"ccc": {
"Name": "my_container_2",
"EndpointID": "ENDPOINTID2",
"MacAddress": "MacAddress2",
"IPv4Address": "0.0.0.0/2",
"IPv6Address": ""
}
},
"Options": {},
"Labels": {}
}
]
如果我只有几个容器,可以手动断开连接,但如果我有 50 个容器,我就会遇到问题。如何使用单个或多个命令断开所有容器与该网络的连接?