10.40.42.10上,也就是对应的VRRP中的10.40.42.1和2上,配置nginx tcp代理
# cat 4000_manager.venic.com_10.40.100.141-142_4000.conf
upstream manager.venic.com {
server 10.40.100.141:4000;
server 10.40.100.142:4000;
}
server {
listen 4000;
proxy_pass manager.venic.com;
}
重启上层nginx代理服务
最终在有docker CLI命令行的机器上使用 docker-manager.venic.com:4000来测试方式
[root@docker-registry ~]# docker -H docker-manager.venic.com:4000 ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2cf7f3288ead docker-registry.venic.com:5000/swarm:latest "/swarm join --advert" 9 minutes ago Up 9 minutes 2375/tcp docker-node1.venic.com/node1
36679f016f7b docker-registry.venic.com:5000/swarm:latest "/swarm join --advert" 9 minutes ago Up 9 minutes 2375/tcp docker-node0.venic.com/node0
[root@docker-registry ~]# docker -H docker-manager.venic.com:4000 run hello-world
[root@docker-registry ~]# docker -H docker-manager.venic.com:4000 ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
350684df98bf hello-world "/hello" 9 seconds ago Exited (0) 8 seconds ago docker-node0.venic.com/sick_shannon
2cf7f3288ead docker-registry.venic.com:5000/swarm:latest "/swarm join --advert" 10 minutes ago Up 10 minutes 2375/tcp docker-node1.venic.com/node1
36679f016f7b docker-registry.venic.com:5000/swarm:latest "/swarm join --advert" 10 minutes ago Up 10 minutes 2375/tcp docker-node0.venic.com/node0
[root@docker-registry ~]# docker -H docker-manager.venic.com:4000 run -it docker-registry.venic.com:5000/ubuntu:latest /bin/sh
#
#
#
#
# uname -a
Linux f078e8079bca 3.10.0-514.2.2.el7.x86_64 #1 SMP Tue Dec 6 23:06:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
#
# docker -H docker-manager.venic.com:4000 ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f078e8079bca docker-registry.venic.com:5000/ubuntu:latest "/bin/sh" 38 seconds ago Up 34 seconds docker-node0.venic.com/ecstatic_visvesvaraya