I have installed docker-ce on a fresh Ubuntu 24.04 installation. (I have also tried 22.04)
However, there is no internet connection in the container:
sudo docker run busybox nslookup google.com
Results in ;; connection timed out; no servers could be reached
It does not matter if I use the --network=host
or --dns=8.8.8.8
options. I've tried restarting docker, and wiping the system, but nothing seems to work.
The docker network interface exists. If I run ifconfig
on the host I get:
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255 inet6 fe80::42:b3ff:fefa:e967 prefixlen 64 scopeid 0x20<link> ether 02:42:b3:fa:e9:67 txqueuelen 0 (Ethernet) RX packets 198 bytes 11640 (11.6 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 229 bytes 27906 (27.9 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
and if I run it within the docker container I get:
eth0 Link encap:Ethernet HWaddr 02:42:AC:11:00:02 inet addr:172.17.0.2 Bcast:172.17.255.255 Mask:255.255.0.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:2 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:220 (220.0 B) TX bytes:0 (0.0 B)
Which looks correct afaict.
Thank you for any help!