Host networking works:
$ docker run -it --network=host busybox ping google.com
PING google.com (142.250.181.238): 56 data bytes
64 bytes from 142.250.181.238: seq=0 ttl=58 time=86.721 ms
64 bytes from 142.250.181.238: seq=1 ttl=58 time=86.572 ms
64 bytes from 142.250.181.238: seq=2 ttl=58 time=86.631 ms
But bridge networking does not work:
$ docker run -it --network=bridge busybox ping google.com
ping: bad address 'google.com'
This is the latest Docker version 24.0.2 installed using: “curl https://get.docker.com/ | sh”
This is a cloud server from IONOS (1 and 1) that I can re-image. It is running Ubuntu 22.04.2 LTS
The Linux kernel version is: 5.15.0-73-generic
I have already tried re-imaging Ubuntu 22.04.2 and re-installing Docker, but that did not help.
I have tried adding /etc/docker/daemon.json
{
"dns": ["212.227.123.16", "212.227.123.17", "8.8.8.8"],
"debug": true,
"default-address-pools": [{"base":"10.11.0.0/24","size":24}]
}
I have edited and rebooted /usr/lib/systemd/network/80-container-host0.network:
[Network]
IPForward=kernel
$ brctl show
bridge name bridge id STP enabled interfaces
docker0 8000.02424eafcdbb no
$ docker network inspect bridge
[
{
"Name": "bridge",
"Id": "2fe2b9b8da6ec5ceea3b7b6ccd3bb513d3e72b181cb1fc1d784d769b1279637e",
"Created": "2023-06-04T17:01:21.576943695Z",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "10.11.0.0/24",
"Gateway": "10.11.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"2b176dfcfac36986b642150fa445c172b21f945cc96051e3921ee28b4dc84bd7": {
"Name": "beautiful_wescoff",
"EndpointID": "56f288769b0be1f723fd25a3b11469c60552d6fe282b3e6d7ae7a3031a4fb81b",
"MacAddress": "02:42:0a:0b:00:02",
"IPv4Address": "10.11.0.2/24",
"IPv6Address": ""
}
},
"Options": {
"com.docker.network.bridge.default_bridge": "true",
"com.docker.network.bridge.enable_icc": "true",
"com.docker.network.bridge.enable_ip_masquerade": "true",
"com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
"com.docker.network.bridge.name": "docker0",
"com.docker.network.driver.mtu": "1500"
},
"Labels": {}
}
]