请大虾们 帮我看看,新搭建的swarm+consul,跨network两容器不通。


环境:
docker 1.9.1
swarm 1.0.1
centos7 内核4.3.3
consul

[root@centos7_test001 ~]# docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
swarm-consul - generic Running tcp://192.168.12.190:2376 v1.9.1

swarm-master - generic Running tcp://192.168.12.191:2376 swarm-master (master) v1.9.1

swarm-node-01 - generic Running tcp://192.168.12.192:2376 swarm-master v1.9.1

swarm-node-02 - generic Running tcp://192.168.12.36:2376 swarm-master v1.9.1

现在同一个network下,两容器互通没问题。
但是不同的network下,两容器不能互通。
大虾们,帮忙看看,谢谢。

[root@centos7_test001 ~]# docker network create -d overlay test001

[root@centos7_test001 ~]# docker run -itd –name=nginx001 –net=test001 nginx

[root@centos7_test001 ~]# docker run -itd –name=nginx002 –net=test001 nginx

[root@centos7_test001 ~]# docker network create -d overlay test002
[root@centos7_test001 ~]# docker run -itd –name=nginx003 –net=test002 nginx
[root@centos7_test001 ~]# docker run -itd –name=nginx004 –net=test002 nginx

[root@centos7_test001 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d635fa4fba9a nginx “nginx -g ‘daemon off” 9 seconds ago Up 7 seconds 80/tcp, 443/tcp swarm-master/nginx004
f093986a1021 nginx “nginx -g ‘daemon off” 21 seconds ago Up 20 seconds 80/tcp, 443/tcp swarm-node-02/nginx003
7352a40eef86 nginx “nginx -g ‘daemon off” About an hour ago Up About an hour 80/tcp, 443/tcp swarm-node-02/nginx002
376df8aecb76 nginx “nginx -g ‘daemon off” About an hour ago Up About an hour 80/tcp, 443/tcp swarm-node-01/nginx001

docker network connect test002 nginx001

nginx003:

root@f093986a1021:/# more /etc/hosts
10.0.0.5 f093986a1021
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
10.0.0.6 nginx004
10.0.0.6 nginx004.test002
10.0.0.7 nginx001
10.0.0.7 nginx001.test002

nginx001:

root@376df8aecb76:/# more /etc/hosts
10.0.0.2 376df8aecb76
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
10.0.0.3 nginx002
10.0.0.3 nginx002.test001
10.0.0.5 nginx003
10.0.0.5 nginx003.test002
10.0.0.6 nginx004
10.0.0.6 nginx004.test002

root@f093986a1021:/# ping nginx001.test002
PING nginx001.test002 (10.0.0.7): 56 data bytes
^C— nginx001.test002 ping statistics —
5 packets transmitted, 0 packets received, 100% packet loss
已邀请:

螃蟹

赞同来自:


这里是我部署及验证全过程:
http://183.230.40.37:54322/docker/193

螃蟹

赞同来自:


我的博客换地址了:
下面是验证过程:
http://www.pangxie.space/docker/193

没人帮忙看看这个问题吗?

要回复问题请先登录注册