Few information about my machine’s docker setup:
docker version
Client:
Version: 18.06.0-ce
API version: 1.38
Go version: go1.10.3
Git commit: 0ffa825
Built: Wed Jul 18 19:11:02 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.06.0-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: 0ffa825
Built: Wed Jul 18 19:09:05 2018
OS/Arch: linux/amd64
Experimental: false
ifconfig
docker0 Link encap:Ethernet HWaddr 02:42:ca:f0:f7:7e
inet addr:172.17.0.1 Bcast:172.17.255.255 Mask:255.255.0.0
inet6 addr: fe80::42:caff:fef0:f77e/64 Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:258 (258.0 B)
enp1s0 Link encap:Ethernet HWaddr 34:17:eb:6e:eb:a7
inet addr:10.10.40.85 Bcast:10.10.40.255 Mask:255.255.255.0
inet6 addr: fe80::5525:f2d0:80d2:bff/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:42559 errors:0 dropped:1 overruns:0 frame:0
TX packets:26253 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:24804212 (24.8 MB) TX bytes:5376361 (5.3 MB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:17108 errors:0 dropped:0 overruns:0 frame:0
TX packets:17108 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:17774570 (17.7 MB) TX bytes:17774570 (17.7 MB)
ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 34:17:eb:6e:eb:a7 brd ff:ff:ff:ff:ff:ff
inet 10.10.40.85/24 brd 10.10.40.255 scope global dynamic enp1s0
valid_lft 16195sec preferred_lft 16195sec
inet6 fe80::5525:f2d0:80d2:bff/64 scope link
valid_lft forever preferred_lft forever
.
.
.
32: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:ca:f0:f7:7e brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
inet6 fe80::42:caff:fef0:f77e/64 scope link
valid_lft forever preferred_lft forever
docker network ls
NETWORK ID NAME DRIVER SCOPE
48302e8ae1cd bridge bridge local
6da5d64a5d5a host host local
0cc5602f06a0 none null local
I am trying to access the host network from container using docker default bridge Docker0 , but that is not working i am not able to ping host gateway or dns from container only docker0 ip i.e. gateway of docker network and host is accessible.
In ip addr output it seems that docker0 link is down it is also showing NO-CARRIER in output.
I have tried various solution given on different forums and docs but got no luck with connectivity.
$ docker run --rm alpine ping google.com
ping: bad address ‘google.com’
$docker run --rm alpine ping -c2 172.17.0.1
PING 172.17.0.1 (172.17.0.1): 56 data bytes
64 bytes from 172.17.0.1: seq=0 ttl=64 time=0.125 ms
64 bytes from 172.17.0.1: seq=1 ttl=64 time=0.129 ms
— 172.17.0.1 ping statistics —
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.125/0.127/0.129 ms
$ docker run --rm alpine ping -c2 10.10.40.85
PING 10.10.40.85 (10.10.40.85): 56 data bytes
64 bytes from 10.10.40.85: seq=0 ttl=64 time=0.141 ms
64 bytes from 10.10.40.85: seq=1 ttl=64 time=0.078 ms
— 10.10.40.85 ping statistics —
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.078/0.109/0.141 ms
$ docker run --rm alpine ping -c2 10.10.40.1
PING 10.10.40.1 (10.10.40.1): 56 data bytes
— 10.10.40.1 ping statistics —
2 packets transmitted, 0 packets received, 100% packet loss
$ docker run --rm alpine traceroute 10.10.40.1
traceroute to 10.10.40.1 (10.10.40.1), 30 hops max, 46 byte packets
1 172.17.0.1 (172.17.0.1) 0.009 ms 0.008 ms 0.006 ms
2 * * *
3 * * *
.
.
.and it goes on.
Can anyone please walk me through !!