Rootless docker, systemd-resolved and DNS inside containers


  • host uses systemd-resolved
  • rootless docker is set up

The issue:
inside containers DNS does not resolve internet addresses.
as i see in containers /etc/resolve.conf is set to
if manually changed to nameserver - dns works fine

don’t see any drops in host’s iptables

I don’t have much experience with docker, but this issue seem to be related to nixos setup, not sure, need guidance
also found this, but not sure what does it mean

Have you got a docker-compose.yaml or the command used to build the containers?

It’s possibly missing some network configuration within docker and / or containers.

  • capabilities (--cap-add=NET_ADMIN or others)
  • host network to containers bridged correctly
  • etc

You can also declare DNS in your docker-compose.yaml or add to the command --dns=
See Networking overview | Docker Docs .

Thank you
I’ve added dns setting to docker.daemon.settings option.
After all, I did not want docker daemon to take my resolve.conf into an image anyway (though it’s said to be the default behaviour, even for systemd-resolved on host)

1 Like