Edit: I've managed to realize that the issue is with bridge networking, as network functionality seems fine with --net=host
.
docker run -it --net=host busybox ping -c 1 8.8.8.8
works consistently.
Looking at this thread on reddit Docker network problem. Only works with --net=host the OP's issue was resolved by uninstalling ebtables. I've done the same but still have the same problem.
--
I've read through numerous threads (see below) trying to get to the bottom of an issue I'm having installing Discourse through a docker instance which fails when it tries to pull from github. Most threads point to issues in DNS, but I realized it's something else as I can't ping a static IP address either.
The discourse install fails with:
cd /pups && git pull && /pups/bin/pups --stdin
fatal: unable to access 'https://github.com/discourse/pups.git/': Could not resolve host: github.com
The oddest thing is that it works immediately after a restart:
systemctl restart docker
docker run -it busybox ping -c 1 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes 64 bytes from 8.8.8.8: seq=0 ttl=58 time=0.646 ms
--- 8.8.8.8 ping statistics --- 1 packets transmitted, 1 packets received, 0% packet loss round-trip min/avg/max = 0.646/0.646/0.646 ms
docker run -it busybox ping -c 1 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
--- 8.8.8.8 ping statistics --- 1 packets transmitted, 0 packets received, 100% packet loss
No matter what, the subsequent call fails. I'm confused how to go about debugging this.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic
Docker version 18.09.5, build e8ff056 (released 2019-04-11)
Attempted fixes:
cat /etc/resolv.conf
return? – Alassane Ndiayenameserver 127.0.0.53 options edns0
- which I understand is problematic from a DNS perspective, but shouldn't pining a static IP still work? – wafflip -r
show a default route? If not, you should add a default route to your gateway. Also, did you change your DHCP settings recently by any chance? This reminds me of an issue I once had. – Alassane Ndiayeip -r
does indeed show a default route to the gateway. I don't think anything has changed as it's a newly provisioned server. I've done all sorts of other tests in the meantime (disabled ipv6, made a custom bridge, flushed all iptables to default) - and same thing, thedocker0
bridge always loses its ip address after a network connection is initiated (only has anether
address). One thing I did notice is that it the system's network interface isens5
vs the typicaleth0
if it matters. – waffldocker network create my-net
anddocker container run --network my-net ...
. If that fixes the issue, you know the problem is caused by the default docker bridge configuration. – Alassane Ndiaye