Reputation: 1664
I cannot execute any command requiring internet connection inside any Docker container.
Works:
docker run ubuntu /bin/echo 'Hello world'
Does not work:
docker run ubuntu apt-get update
Err:1 http://archive.ubuntu.com/ubuntu xenial InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu xenial-security InRelease
Temporary failure resolving 'archive.ubuntu.com'
Reading package lists...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-security/InRelease Temporary failure resolving 'archive.ubuntu.com'
Similar with pip
and ping
.
I am on Ubuntu 16.04 and not using firewall or corporate proxy server and have tried to restart Docker. Not using docker-machine or boot2docker.
Upvotes: 1
Views: 10454
Reputation: 1
I solved it with the following sequence:
connman
if not installed earlier:sudo apt update
sudo apt install connman -y
sudo nano /etc/connman/main.conf
sudo reboot
Upvotes: 0
Reputation: 165
In my case only deleteting the docker0 interface wasn't enough,j I had to delete the br interfaces (see ip link
) as well.
For the Linux users out there that use systemd:
#!/usr/bin/env sh
if ! [ "$(id -u)" = "0" ]; then
echo "Run as root please."
exit 1
fi
# not sure if this is needed
iptables -t nat -F
# stop docker
systemctl stop docker
# stop the `br-...` interfaces.
ip link | awk -F': ' '/: br-/ {print $2}' | xargs -I % ifconfig % down
# ... and remove them
ip link | awk -F': ' '/: br-/ {print $2}' | xargs brctl delbr
# stop the docker0 interface
ifconfig docker0 down
# ... and remove it
brctl delbr docker0
# start docker again, this will re-create the docker0 interface.
systemctl start docker
Upvotes: 0
Reputation: 1664
pkill docker
iptables -t nat -F
ifconfig docker0 down
brctl delbr docker0
docker -d
"It will force docker to recreate the bridge and reinit all the network rules"
Upvotes: 6