Keep /run/systemd/resolve visible if it exists and --keep-system-config is used.
On systems with systemd-resolved, /etc/resolv.conf is a symlink to a
file in this directory, so if it is hidden, DNS lookups do not work.
@@ -121,10 +121,13 @@ def handle_basic_container_args(options, parser=None):
"host lookups will fail despite --network-access. "
"Consider using --keep-system-config.")
else:
- if not "/run/resolvconf" in dir_modes and os.path.isdir("/run/resolvconf"):
# /etc/resolv.conf is necessary for DNS lookups and on many systems is a symlink
- # to /run/resolvconf/resolv.conf, so we keep that directory accessible as well.
+ # to either /run/resolvconf/resolv.conf or /run/systemd/resolve/sub-resolve.conf,
+ # so we keep that directory accessible as well.
+ if not "/run/resolvconf" in dir_modes and os.path.isdir("/run/resolvconf"):
dir_modes["/run/resolvconf"] = DIR_READ_ONLY
+ if not "/run/systemd/resolve" in dir_modes and os.path.isdir("/run/systemd/resolve"):
+ dir_modes["/run/systemd/resolve"] = DIR_READ_ONLY
return {
'network_access': options.network_access,
