无法访问不同主机上的容器

时间:2016-09-08 09:54:05

标签: docker docker-cloud

我有一个有2个服务的堆栈: 1. dockercloud / haproxy作为负载均衡器 2.用于ssl终止的mycustom / nginx

我有2个主机,每个服务有2个容器。每个主机上一个。 主持人1: * Haproxy-1(IP:10.7.0.9) * Nginx-1(IP:10.7.0.7)

主持人2: * Haproxy 2(IP:10.7.0.10) * Nginx 2(IP:10.7.0.8)

问题是我无法从主机1上的容器连接到主机2上的容器。 当在主机1上连接并尝试跟踪路由Haproxy 2(10.7.0.7)时,我得到了这个:

  

traceroute到10.7.0.7(10.7.0.7),最多30跳,60字节包1   10.7.255.254(10.7.255.254)2997.863 ms!H 2997.704 ms!H 2997.684 ms!H

有任何建议如何解决这个问题?

修改

码头信息

Containers: 12
 Running: 11
 Paused: 0
 Stopped: 1
Images: 12
Server Version: 1.11.1-cs1
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 90
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: null host bridge weavemesh
Kernel Version: 3.16.0-4-amd64
Operating System: Debian GNU/Linux 8 (jessie)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 5.813 GiB
Name: Debian-85-jessie-64-minimal
ID: BV3I:KVWH:L45Q:CV2D:IOTX:BG7W:YAUV:S4QG:AJ44:BTVK:J3VJ:RWJA
Docker Root Dir: /var/lib/docker
Debug mode (client): false
Debug mode (server): false
Registry: https://index.docker.io/v1/
WARNING: No memory limit support
WARNING: No swap limit support
WARNING: No kernel memory limit support
WARNING: No oom kill disable support
WARNING: No cpu cfs quota support
WARNING: No cpu cfs period support

docker version

Client:
 Version:      1.11.1-cs1
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   bfd1f99
 Built:        Wed Apr 27 22:35:34 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.11.1-cs1
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   bfd1f99
 Built:        Wed Apr 27 22:35:34 2016
 OS/Arch:      linux/amd64

docker network ls

NETWORK ID          NAME                DRIVER
719bbcb667f2        bridge              bridge
acb91ed95ada        dockercloud         weavemesh
c4be8b540ad6        host                host
c57e28b9d274        none                null
8d3859eb8bfd        weave               weavemesh

我使用dockercloud来设置服务。所以我自己没有使用任何命令。

编辑2

这是nginx-1的ifconfig:

eth0      Link encap:Ethernet  HWaddr 02:42:AC:11:00:07                                                                                                                  
          inet addr:172.17.0.7  Bcast:0.0.0.0  Mask:255.255.0.0                                                                                                          
          inet6 addr: fe80::42:acff:fe11:7%32596/64 Scope:Link                                                                                                           
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1                                                                                                             
          RX packets:530 errors:0 dropped:0 overruns:0 frame:0                                                                                                           
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0                                                                                                          
          collisions:0 txqueuelen:0                                                                                                                                      
          RX bytes:45267 (44.2 KiB)  TX bytes:956 (956.0 B)                                                                                                              

ethwe1    Link encap:Ethernet  HWaddr DE:1C:3F:DF:E9:0C                                                                                                                  
          inet addr:10.7.0.7  Bcast:0.0.0.0  Mask:255.255.0.0                                                                                                            
          inet6 addr: fe80::dc1c:3fff:fedf:e90c%32596/64 Scope:Link                                                                                                      
          UP BROADCAST RUNNING MULTICAST  MTU:1410  Metric:1                                                                                                             
          RX packets:62 errors:0 dropped:0 overruns:0 frame:0                                                                                                            
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0                                                                                                           
          collisions:0 txqueuelen:0                                                                                                                                      
          RX bytes:5164 (5.0 KiB)  TX bytes:648 (648.0 B)   

这是nginx-2的ifconfig:

eth0      Link encap:Ethernet  HWaddr 02:42:AC:11:00:08                                                                                                                  
          inet addr:172.17.0.8  Bcast:0.0.0.0  Mask:255.255.0.0                                                                                                          
          inet6 addr: fe80::42:acff:fe11:8%32566/64 Scope:Link                                                                                                           
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1                                                                                                             
          RX packets:174 errors:0 dropped:0 overruns:0 frame:0                                                                                                           
          TX packets:21 errors:0 dropped:0 overruns:0 carrier:0                                                                                                          
          collisions:0 txqueuelen:0                                                                                                                                      
          RX bytes:14399 (14.0 KiB)  TX bytes:2076 (2.0 KiB)                                                                                                             

ethwe1    Link encap:Ethernet  HWaddr B2:A0:36:AF:0B:95                                                                                                                  
          inet addr:10.7.0.8  Bcast:0.0.0.0  Mask:255.255.0.0                                                                                                            
          inet6 addr: fe80::b0a0:36ff:feaf:b95%32566/64 Scope:Link                                                                                                       
          UP BROADCAST RUNNING MULTICAST  MTU:1410  Metric:1                                                                                                             
          RX packets:643722 errors:0 dropped:0 overruns:0 frame:0                                                                                                        
          TX packets:369311 errors:0 dropped:0 overruns:0 carrier:0                                                                                                      
          collisions:0 txqueuelen:0                                                                                                                                      
          RX bytes:66498273 (63.4 MiB)  TX 

字节:31055890(29.6 MiB)

0 个答案:

没有答案