Is systemd-resolved required inside container if docker is using host network

Hello,

So I am currently facing a issue regarding systemd-resolved within containers.

I’m using host network for both my redhat and centos containers. However recently my centos container fails to resolve when running yum update. I made to use vault.centos repos as well. Looking at systemd-resolved within the containers, it’s running but posting dnssec errors. If I manually add Google dns then it post LLMNR errors (makes sense since the host is using the port). I checked my redhat container and I see systemd-resolved is stopped/disabled there. Enabling it gives me the LLMNR error as well. I have no dnssec error or dns resolution error in the redhat container.

Which leads me to this question. Is systemd-resolved being disabled within the container the correct way if I’m using the host networks anyway? Or is there a specific config file within the container I need to change to allow for proper dnssec and llmnr function?

Containers are not virtual machines. Systemd is never required. A process in a container is just a process on the host. The difference is that the process in the container just cannot see everything around it. You cannot enable systemd services since systemd is not running in the container as the init process.

Regarding LLMNR, I am not familiar with it. Does it require systemd?

LLMNR requires systemd-resolved. Its mostly useful for local dns resolution using hostname. It is running on my host, it complains on the container because the host is already using the port. However, i dont know if any of my applications needs it at all. Im using the container to load rhel library to run commercial cfd applications. Im using network host to expose host display for my applications. Im using nvidia-runtime for cuda support. And systemd is only there for me to launch license servers (however based on what you said, these services is running on host anyway).

Im running an init process with docker run and using docker exec to run bash. Everything works, but recently ive been having this dns issue only with my centos container