I am trying to run docker on Arch Linux. My containers cannot connect to the internet and therefore cannot add software, etc. I have set up forwarding as instructed:
sudo sysctl net.ipv4.ip_forward=1
But I still get errors like this:
bpotter@lore➜ ~/tmp» docker run ubuntu apt-get install -y ping
Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
iputils-ping
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 56.1 kB of archives.
After this operation, 143 kB of additional disk space will be used.
Err http://archive.ubuntu.com/ubuntu/ precise/main iputils-ping amd64 3:20101006-1ubuntu1
Temporary failure resolving 'archive.ubuntu.com'
Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/i/iputils/iputils-ping_20101006-1ubuntu1_amd64.deb Temporary failure resolving 'archive.ubuntu.com'
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
and this:
bpotter@lore➜ ~/tmp» docker run abhay/ping_function ping -c 3 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2007ms
I am considering setting up a bridge device, but I thought that allowing forwarding should make that unnecessary. I'd rather not get started with netctl if I don't have to.
How can I configure my machine and docker so that I can connect to the internet from within my docker container?
I saw the same problem at my previous workplace. I don't know whether the cause was the same in this case (or even whether this is still a problem), but there the default docker dns server (from within the container - 8.8.8.8) was blocked by my corporate network.
The resolution was to use the --dns flag when running containers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With