Skip to content

DNS issues in user-defined docker networks #575

@cmainas

Description

@cmainas

The DNS resolution for urunc-based containers which start in a user-defined network of docker does not work. To reproduce the issue:

  1. Create a new network in docker.
$ sudo docker network create -d bridge my-bridge-network
74bc6ad05c22bdec6267fe95d27b3c3ac13be3bda89c73463890068893bbbaff
  1. 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
  1. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    K8s/ToolsRelated to container/cloud native tools, orchestratorsNetwork

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions