The DNS resolution for urunc-based containers which start in a user-defined network of docker does not work. To reproduce the issue:
- Create a new network in docker.
$ sudo docker network create -d bridge my-bridge-network
74bc6ad05c22bdec6267fe95d27b3c3ac13be3bda89c73463890068893bbbaff
- Start a urunc container in this network:
$ sudo docker run --rm --network my-bridge-network -it --runtime io.containerd.urunc.v2 harbor.nbfc.io/nubificus/urunc/busybox-qemu-linux-raw:latest
- From inside the container try to resolve any domain:
# nslookup github.com
nslookup: write to '127.0.0.11': Connection refused
;; connection timed out; no servers could be reached
As shown from nslookup, the DNS request goes to 127.0.0.11. Also the /etc/resolv.conf of the container:
# cat /etc/resolv.conf
# Generated by Docker Engine.
# This file can be edited; Docker Engine will not make further changes once it
# has been modified.
nameserver 127.0.0.11
...
This happens because docker sets up an internal DNS server which listens at localhost for each container inside the network namespace (See https://docs.docker.com/engine/network/#dns-services). Therefore, when docker sets the localhost as a DNS server in /etc/resolv.conf, a urunc based container does not communicate with the localhost of the network namespace in the host, but with the localhost inside the sandbox and hence the request fails.
The DNS resolution for urunc-based containers which start in a user-defined network of docker does not work. To reproduce the issue:
As shown from nslookup, the DNS request goes to
127.0.0.11. Also the/etc/resolv.confof the container:This happens because docker sets up an internal DNS server which listens at localhost for each container inside the network namespace (See https://docs.docker.com/engine/network/#dns-services). Therefore, when docker sets the localhost as a DNS server in
/etc/resolv.conf, a urunc based container does not communicate with the localhost of the network namespace in the host, but with the localhost inside the sandbox and hence the request fails.