docker service create 网络模式 host ,用-p 指定端口 不能启动,如下
一直重复 preparing
[root@BizMsTestAlpha test]# docker service create --replicas 1 --network host -p 8081:8081 --name test test
image test:latest could not be accessed on a registry to record
its digest. Each node will access test:latest independently,
possibly leading to different nodes running different
versions of the image.
0bzoexlk04fi53qiwmolq7d6f
overall progress: 0 out of 1 tasks
1/1: preparing [=================================> ]
去掉-p 指定端口就能正常启动,如下:
[root@BizMsTestAlpha test]# docker service create --replicas 1 --network host --name test test
image test:latest could not be accessed on a registry to record
its digest. Each node will access test:latest independently,
possibly leading to different nodes running different
versions of the image.
y82wjcxg3ndtevslt9bxbotep
overall progress: 1 out of 1 tasks
1/1: running [==================================================>]
verify: Service converged
[root@BizMsTestAlpha test]#
swarm service 网络模式host
会直接使用task运行所在主机实际网络和端口,同一主机上运行多个task会存在端口重复绑定导致只能启动一个的问题
没有swarm 集群负载均衡功能
上述2个问题 使用overlay网络模式 不存在
注意:云服务器一般都不支持docker swarm overlay多机集群,存在端口冲突,都使用了 vxlan网络需要udp端口4789