Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Please mount resolv.conf in systemd-nspawn by default #5075
systemd version the issue has been seen with
I use systemd-nspawn. Usually I use Debian as system for both host system and container. It seems systemd doesn't manage resolv.conf in Debian.
Please, automount resolv.conf in systemd-nspawn by default. I. e. make option "--bind /etc/resolv.conf:/etc/resolv.conf" default. I often change internet connection on my host system. And this doesn't change /etc/resolv.conf inside container by default.
Sorry, but this is not going to work. Most software modifying /etc/resolv.conf actually writes the new config into a new temporary file and then simply renames it to /etc/resolv.conf, so that from the outside things are atomic: either the old version or the new version is in place, but never a half-written version.
This logic is incomptible with bind mounts, as with them the actual file itself is referenced, not the path to it. Hence, after the first such update the container will still see the old version, and this cannot even be fixed.
Hence, bind mounting doesn't really help much. If anything it makes things worse, not better.
Note that we actually already fall back to bind mounting if we operate on a read-only OS image, because then we have no other option.
Anyway, closing this, as this wouldn't work. I hope this makes sense, Sorry!