当Docker服务在我的Windows Server 2016 VM上启动时,它会自行创建一些l2bridge网络。我需要理解为什么会这样做,以及如何阻止它这样做。
这是PowerShell中的一个示例:
PS C:\Users\Administrator> docker network ls
NETWORK ID NAME DRIVER SCOPE
ca219b21052e 7801716e9583cad0ba3ed1485f31565c458137a6e4f40cca94843ba2832df54a l2bridge local
f5f624883546 baa71d645232fc8af24bab5be539c72834b5a4242f50f5c74b63e6232087a68c l2bridge local
b3fc9850bded bea5e6edfeee221543be2d04f302974e55684dd969a0f4876e4f56126bcc7069 l2bridge local
9c842e81e14c c0785dea1abcaac43a253b0c1486ad83c163deb8773a93a38b61cec49b5a6fef l2bridge local
a79de5fb36a2 dbbd1fb27d805f460e87db6146a10e97961434e5a0d8747c81b1e5d3961d3340 l2bridge local
8149a6d53b76 efecb0a306cc5f27d1a7de2c86715d10e353aff28a72da524d830da1fc629b2c l2bridge local
f247c7ba98d0 nat nat local
987a17d6b0c9 none null local
PS C:\Users\Administrator> docker network rm $(docker network ls -q)
ca219b21052e
f5f624883546
b3fc9850bded
9c842e81e14c
a79de5fb36a2
8149a6d53b76
Error response from daemon: nat is a pre-defined network and cannot be removed
Error response from daemon: none is a pre-defined network and cannot be removed
PS C:\Users\Administrator> docker network ls
NETWORK ID NAME DRIVER SCOPE
f247c7ba98d0 nat nat local
987a17d6b0c9 none null local
PS C:\Users\Administrator> Stop-Service docker
PS C:\Users\Administrator> Start-Service docker
WARNING: Waiting for service 'docker (Docker)' to start...
WARNING: Waiting for service 'docker (Docker)' to start...
WARNING: Waiting for service 'docker (Docker)' to start...
WARNING: Waiting for service 'docker (Docker)' to start...
WARNING: Waiting for service 'docker (Docker)' to start...
WARNING: Waiting for service 'docker (Docker)' to start...
WARNING: Waiting for service 'docker (Docker)' to start...
PS C:\Users\Administrator> docker network ls
NETWORK ID NAME DRIVER SCOPE
0376f6b22711 7801716e9583cad0ba3ed1485f31565c458137a6e4f40cca94843ba2832df54a l2bridge local
0d4c458937b3 baa71d645232fc8af24bab5be539c72834b5a4242f50f5c74b63e6232087a68c l2bridge local
6b6df27f9900 bea5e6edfeee221543be2d04f302974e55684dd969a0f4876e4f56126bcc7069 l2bridge local
3edc036ec10a c0785dea1abcaac43a253b0c1486ad83c163deb8773a93a38b61cec49b5a6fef l2bridge local
b5205dae811c dbbd1fb27d805f460e87db6146a10e97961434e5a0d8747c81b1e5d3961d3340 l2bridge local
2fbb193b5d3c efecb0a306cc5f27d1a7de2c86715d10e353aff28a72da524d830da1fc629b2c l2bridge local
fd67e0d563f4 nat nat local
830c63dbbab7 none null local
我正在运行Docker版本17.03.1-ee-3,构建3fcee33。
更新: 以下是docker network inspect的输出:
PS C:\Users\Administrator> docker network inspect 859d73d47265
[
{
"Name": "f03805eacff6242bcd2b542c2b43dc203028268734fe5bd4cff5bd9ab924169a",
"Id": "859d73d4726589c7167adb968e9a2338604ffc0033b43b95b092feeafd692785",
"Created": "2017-11-01T13:01:35.7797185+02:00",
"Scope": "local",
"Driver": "l2bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "windows",
"Options": null,
"Config": [
{
"Subnet": "192.168.0.0/24",
"Gateway": "192.168.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Containers": {},
"Options": {
"com.docker.network.windowsshim.hnsid": "533b975d-f6a3-47d3-887c-8286096e67e4",
"com.docker.network.windowsshim.networkname": "f03805eacff6242bcd2b542c2b43dc203028268734fe5bd4cff5bd9ab9241
69a"
},
"Labels": {}
}
]