Baptiste Arnaud
Baptiste Arnaud

Reputation: 2750

Docker Ubuntu 16 on a Ubuntu 14 machine : no Internet connection

I run a Ubuntu docker on my machine but when i type the apt-get update command, it says :

root@50e964833537:/# 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... Done        
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'
W: Some index files failed to download. They have been ignored, or old ones used instead.

I tried several "solutions" I found but still it doesn't work. I don't have access to any command in the docker because I can't update. I suppose because my Docker doesn't have access to Internet. How can I fix this ?

Upvotes: 0

Views: 754

Answers (2)

harpratap
harpratap

Reputation: 365

For me it was our Internal VPN causing the issue. You should try turning it off once just to be sure.

This solution will work for you in this case.

pkill docker; iptables -t nat -F; ifconfig docker0 down; brctl delbr docker0

Upvotes: 0

Baptiste Arnaud
Baptiste Arnaud

Reputation: 2750

SOLUTION :

I'm in a corporate network so I had to change the DNS ip adresses by follow these steps :

On the Host Machine :

  • nm-tool | grep DNS It will output the DNS servers
  • sudo nano /etc/default/docker and change the following line with DNS you got in the first step:
    • DOCKER_OPTS="--dns 'your_dns_server_1' --dns 'your_dns_server_2'"
  • Restart docker : sudo service docker restart

Upvotes: 1

Related Questions