Docker Community Forums

Share and learn in the Docker community.

Docker container can't connect to internet


(Rezenders) #1

Hello all,

I am trying to use docker but I can’t get it to connect to the internet. I am running archlinux.

$ docker run -it ubuntu apt update Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease Temporary failure resolving 'archive.ubuntu.com' Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease Temporary failure resolving 'security.ubuntu.com' Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease Temporary failure resolving 'archive.ubuntu.com' Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease Temporary failure resolving 'archive.ubuntu.com'

I followed the instructions on https://wiki.archlinux.org/index.php/Internet_sharing#Enable_packet_forwarding and enabled forwarding, however it didn’t work

$ cat /etc/sysctl.d/30-ipforward.conf net.ipv4.ip_forward=1 net.ipv6.conf.default.forwarding=1 net.ipv6.conf.all.forwarding=1

I also tried to ping an ip directly to check if it is a DNS problem, but it also doesn’t work.

[code]$ docker run busybox ping -c 1 192.203.230.10
PING 192.203.230.10 (192.203.230.10): 56 data bytes

— 192.203.230.10 ping statistics —
1 packets transmitted, 0 packets received, 100% packet loss [/code]

If I pass the flag --net=host it works

$ docker run -it --net=host ubuntu apt update