我有一個AWS EC2實例Docker容器正在運行,Docker容器通過Docker網絡連接,該網絡通過etcd集羣進行復制。 但所有容器都無法連接到外部。例如,如果我ping或捲曲主機丟失100%的包。 etcd網絡通過AWS私有IP進行通信。Docker容器無法連接到互聯網
這裏是我的搬運工信息:
[email protected]:/home# docker info
Containers: 3
Running: 3
Paused: 0
Stopped: 0
Images: 9
Server Version: 17.05.0-ce
Storage Driver: devicemapper
Pool Name: docker-202:1-2050903-pool
Pool Blocksize: 65.54kB
Base Device Size: 10.74GB
Backing Filesystem: xfs
Data file: /dev/loop0
Metadata file: /dev/loop1
Data Space Used: 4.554GB
Data Space Total: 107.4GB
Data Space Available: 102.8GB
Metadata Space Used:sattler 6.922MB
Metadata Space Total: 2.147GB
Metadata Space Available: 2.141GB
Thin Pool Minimum Free Space: 3.221GB
Udev Sync Supported: true
Deferred Removal Enabled: false
Deferred Deletion Enabled: false
Deferred Deleted Device Count: 0
Data loop file: /var/lib/docker/devicemapper/devicemapper/data
Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
Library Version: 1.02.110 (2015-10-30)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9048e5e50717ea4497b757314bad98ea3763c145
runc version: 9c2d8d184e5da67c95d601382adf14862e4f2228
init version: 949e6fa
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.4.0-1028-aws
Operating System: Ubuntu 16.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 7.303GiB
Name: ip-10-0-127-34
ID: JFQO:C56I:VM22:UDKJ:QDKD:HUDT:KL3X:JCSR:WAPG:66JL:S4RM:4ENN
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Cluster Store: etcd://127.0.0.1:2379
Cluster Advertise: 10.0.127.34:2376
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: devicemapper: usage of loopback devices is strongly discouraged for production use.
Use `--storage-opt dm.thinpooldev` to specify a custom block storage device.
WARNING: No swap limit support
泊塢檢查網絡:
{
"Name": "df-global",
"Id": "59aef8ccc5d7464ee715428783b9b03ba7737d298f41cc30a21f4856e75b92c1",
"Created": "2017-08-14T09:51:31.650109966Z",
"Scope": "global",
"Driver": "overlay",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": {},
"Config": [
{
"Subnet": "192.168.1.0/14"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"Containers": {
"ep-f257d697653d801395f9154d086a6290694d6ded7aefe827c67dcd10808023eb": {
"Name": "elasticsearch-data-1",
"EndpointID": "f257d697653d801395f9154d086a6290694d6ded7aefe827c67dcd10808023eb",
"MacAddress": "02:42:c0:a8:00:0b",
"IPv4Address": "192.168.0.11/14",
"IPv6Address": ""
},
"ep-f5c1be7a768802154b58b33e67a3f009df1d4f1336297df9f914be9a720bd8ce": {
"Name": "postgresql-vg_internal01-prod",
"EndpointID": "f5c1be7a768802154b58b33e67a3f009df1d4f1336297df9f914be9a720bd8ce",
"MacAddress": "02:42:c0:a8:00:02",
"IPv4Address": "192.168.0.2/14",
"IPv6Address": ""
同樣的問題在這裏描述:https://forums.docker.com/t/ping-between-containers-on-different-docker-host-but-connected-by-overlay-networ-fails/9960 但沒有答案
感謝您的回答。如果我嘗試ping本地主機,則會收到100%的包丟失和目標主機無法訪問的信息 'root @ be845f307ee6:/#ping 172.17.2.1 PING 172.17.2.1(172.17.2.1)56(84)數據字節。 從172.17.0.3 icmp_seq = 1個目標主機不可訪問 從172.17.0.3 icmp_seq = 2目的地主機不可達 從172.17.0.3 icmp_seq = 3目的地主機不可達 ^ C --- 172.17.2.1 ping統計--- 5數據包傳輸,0收到,+3錯誤,100%數據包丟失,時間4022ms 管3' – ghovat
嘗試其他答案..如果仍然沒有運氣..我會幫助你使你的路由表和網絡固定能夠ping主機 –
我將Docker網絡更改爲docker網絡創建-d覆蓋--subnet 192.168.1.0/14 df-global 現在我可以蜷縮或ping外部的google.com和網站,但是如果我嘗試連接或ping到其他網絡中的容器丟失了一個包。 例如ping db01-prod是一個碼頭集裝箱。我看到容器,如果我做碼頭網絡檢查名稱 – ghovat