-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Description
Description
DNS resolving inside a container is failing upon computer reboot with the restart always/unless stopped policy and a custom bridge network
Reproduce
- docker network create -d bridge my-net
- docker run -d --network=my-net --restart=unless-stopped --name bug-test-docker nginx:alpine
(I'm using nginx to have a simple daemon running, works with any image) - reboot the computer
Now the bug is a 100% active - docker exec bug-test-docker sh -c "ping archlinux.org"
watch it fail
You can run 'docker exec bug-test-docker sh -c "ping 95.217.163.246"' and it will work, proving that the problem occurs dns side
running 'docker exec bug-test-docker sh -c "cat /etc/resolv.conf"' shows that the nameserver is 127.0.0.11, my guess is that docker messes up upon restart and doesn't bridge whatever dns it was serving in the container's 127.0.0.1
Expected behavior
the network should behave properly upon reboot and resolve the DNS
docker version
Client:
Version: 28.0.1
API version: 1.48
Go version: go1.24.1
Git commit: 068a01ea94
Built: Thu Mar 6 19:09:48 2025
OS/Arch: linux/amd64
Context: default
Server:
Engine:
Version: 28.0.1
API version: 1.48 (minimum version 1.24)
Go version: go1.24.1
Git commit: bbd0a17ccc
Built: Thu Mar 6 19:09:48 2025
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v2.0.3
GitCommit: 06b99ca80cdbfbc6cc8bd567021738c9af2b36ce.m
runc:
Version: 1.2.5
GitCommit:
docker-init:
Version: 0.19.0
GitCommit: de40ad0
docker info
Client:
Version: 28.0.1
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: 0.21.2
Path: /usr/lib/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: 2.33.1
Path: /usr/lib/docker/cli-plugins/docker-compose
Server:
Containers: 1
Running: 1
Paused: 0
Stopped: 0
Images: 12
Server Version: 28.0.1
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: true
Native Overlay Diff: false
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b99ca80cdbfbc6cc8bd567021738c9af2b36ce.m
runc version:
init version: de40ad0
Security Options:
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.13.7-arch1-1
Operating System: Arch Linux
OSType: linux
Architecture: x86_64
CPUs: 12
Total Memory: 15.54GiB
Name: Nuh-huh
ID: 85d57766-b8d5-4beb-b63a-6724cbb29af6
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
::1/128
127.0.0.0/8
Live Restore Enabled: false
Additional Info
I initially started having this issue with docker compose and it was very inconsistent (docker compose down and then docker compose up -d would not cause the issue until a linux kernel upgrade, but docker compose restart will cause the issue on reboot (seems to be linked to whether or not the network is created with the container)), but upon further inspection it happens with docker too