I am trying to build a docker image by using the ones in the repository however i haven't been able to run 'apt-get update' 'apt-get install' commands because it seems that the container is not connected to the internet. I think the problem is caused by the fact that i am using a wireless connection. Is there a way to configure the docker or lxc to use the wireless network instead of the ethernet.
Asked
Active
Viewed 1.1k times
2 Answers
15
I see two possibility:
1) Make sure your ip_forward is set to 1 (sysctl -w net.ipv4.ip_forward=1
)
2) Make sure it is not a DNS issue: try docker run base ping google.com
, if it does not work, you can set custom dns server: docker run -dns 8.8.8.8 base ping google.com
.

creack
- 116,210
- 12
- 97
- 73
-
Thank you very much the second one worked for me. For those who might think that it was caused by the wireless network, i have also tried this by using a virtual machine which was supposed to use the ethernet only. But it does not work either, as you said it was only a DNS issue. – sarslanhan Jun 08 '13 at 22:14
-
Doesn't work for me - clean installation in Ubuntu 13.04 and I'm getting `ping: unknown host google.com`. – metakermit Aug 06 '13 at 22:44
-
4ah, ok now it does. I didn't have internet access because I didn't restart my docker daemon after I connected to a different network (in the first one I had to create a bridge manually due to [Issue 362](https://github.com/dotcloud/docker/issues/362)). – metakermit Aug 07 '13 at 09:20
-
1That solution worked for me too, I was connected to a VPN when running the container, on first run it set it to the VPN provider DNS, changing DNS to above brought the internet back, thanks – Aftab Naveed Dec 22 '14 at 07:05
1
I've had issues on Mint 15 (based on Ubuntu 13.04) which sound exactly like this. For me, the problem appeared after getting out of suspend. While my system had internet access, the docker containers did not. For me, a restart did the trick, but creacks solution might have worked as well...

qkrijger
- 26,686
- 6
- 36
- 37