由docker-compose创建的网络不遵守/etc/docker/daemon.json文件中定义的网络掩码。 docker-compose创建的网络与公司Intranet中已经存在的网络掩码发生冲突。而且这种网络掩码冲突导致我失去了来自Docker主机服务器的ssh访问权限
{"bip":"172.26.0.1/24"}
在运行docker-compose之前的网络
$docker network ls
NETWORK ID NAME DRIVER SCOPE
cbe2788a102c bridge bridge local
3eefbb3e5bf1 host host local
25e41883140e none null local
version: '3'
services:
jenkins:
image: "jenkins/jenkins:2.159-slim"
ports:
- "80:8080"
- "50000:50000"
volumes:
- "jenkins_home:/var/jenkins_home"
volumes:
jenkins_home:
run docker-compose up
并且发生网络冲突。 在我的桌面上,我根本无法上网 如果它在实际的服务器之一上,我会错过与它的ssh连接
运行docker-compose之后的网络
$docker network ls
NETWORK ID NAME DRIVER SCOPE
cbe2788a102c bridge bridge local
3eefbb3e5bf1 host host local
e9ea098f6277 jenkins_default bridge local
25e41883140e none null local
docker network inspect e9ea098f6277
[
{
"Name": "jenkins_default",
"Id": "e9ea098f62779b5c9429d21c4cc8ff42904164f24f4819318d17b88e05bff2f2",
"Created": "2019-01-15T12:32:48.794784601-03:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.17.0.0/16",
"Gateway": "172.17.0.1"
}
]
},
"Internal": false,
"Attachable": true,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"5c36b61fadf7ce337aa70720449e0b12df088a5eb3748b4056bce620f9e92d86": {
"Name": "jenkins_jenkins_1",
"EndpointID": "d437f0195fd819acb0e5bd9992b50b371680257037b94cd5963a314852421b8b",
"MacAddress": "02:42:ac:11:00:02",
"IPv4Address": "172.17.0.2/16",
"IPv6Address": ""
}
},
"Options": {},
"Labels": {
"com.docker.compose.network": "default",
"com.docker.compose.project": "jenkins",
"com.docker.compose.version": "1.23.2"
}
}
]