Docker默认桥接断开

时间:2018-10-10 19:47:19

标签: docker docker-network

您好,我正在阅读有关网络(尤其是网桥)的docker文档,但找不到以下声明的案例:

enter image description here

所以基本上在我的情况下,我一直在运行以下命令:

$ docker run --name web1 -d -p 8080:80 nginx
$docker container inspect web1  -f {{.NetworkSettings.Networks}}
map[bridge:0xc420100000]
$docker network create -d bridge my-bridge
$ docker network connect my-bridge web1
$ docker container inspect web1  -f {{.NetworkSettings.Networks}}
map[bridge:0xc420100000 my-bridge:0xc420100180] //Two networks custom and default bridge

$ docker network inspect bridge -f {{.Containers}}
map[7ef03c3a463e1b776a71455a1c6ae5fab87ec4abf6cbd8d642b2ee30be1235e8: 
{web1 43b261a3a74a89375d2c7425607e4c1929d6b01b3327247779539e15032715d7 
02:42:ac:11:00:02 172.17.0.2/16 }] // default bridge connected to web1

//now I am disconnecting default bridge 
$ docker network disconnect bridge web1

//And then we have : 
$ docker network inspect bridge -f {{.Containers}}
map[]  --not connected to web1

$ docker container inspect web1 -f {{.NetworkSettings.Networks}}
map[my-bridge:0xc420100000]   -- no default bridge

这是否意味着文档错误?我的意思是这部分:

“要从默认网桥网络中删除容器,您需要停止该容器并使用其他网络选项重新创建它”

看起来像错了,或者我错过了某件事...

0 个答案:

没有答案