在某些时候,docker自动生成的ingress网络会与服务器上已经存在的网络产生冲突,这个时候,你须要自定义ingress。node
在自定义前,你须要删除全部有端口发布的服务。docker
使用命令docker network inspect ingress
查看全部链接到网络的服务,并中止全部的服务,不然,下一步操做将会失败。服务器
Remove the existing ingress network:网络
$ docker network rm ingress WARNING! Before removing the routing-mesh network, make sure all the nodes in your swarm run the same docker engine version. Otherwise, removal may not be effective and functionality of newly create ingress networks will be impaired. Are you sure you want to continue? [y/N]
--ingress
选项建立一个新的ingress网络,并设置新的子网信息等。$ docker network create \ -d overlay \ --ingress \ --subnet=10.11.0.0/16 \ --gateway=10.11.0.2 \ --opt com.docker.network.mtu=1200 \ my-ingress
Note: You can name your ingress network something other than ingress, but you can only have one. An attempt to create a second one will fail..net
该功能公支持docker 17.05及之后版本code