summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorafg <afg984@gmail.com>2018-08-29 09:20:27 +0800
committerLennart Poettering <lennart@poettering.net>2018-09-12 20:48:21 +0200
commit27b620b7dba0e7d0cacecc34f62dfb2b27d2164f (patch)
treed41330bcb8fd53af847721ae37648f16ca405558
parentb0b3ba69c0c3990a426caf9773b45975c6b35f5a (diff)
downloadsystemd-27b620b7dba0e7d0cacecc34f62dfb2b27d2164f.tar.gz
nspawn: use copy-static if systemd-resolved is up and image is writable
-rw-r--r--src/nspawn/nspawn.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index f078632265..cd2c39ac7c 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -1656,12 +1656,7 @@ static int setup_resolv_conf(const char *dest) {
if (arg_private_network)
m = RESOLV_CONF_OFF;
else if (have_resolv_conf(STATIC_RESOLV_CONF) > 0 && resolved_listening() > 0)
- /* resolved is enabled on the host. In this, case bind mount its static resolv.conf file into the
- * container, so that the container can use the host's resolver. Given that network namespacing is
- * disabled it's only natural of the container also uses the host's resolver. It also has the big
- * advantage that the container will be able to follow the host's DNS server configuration changes
- * transparently. */
- m = RESOLV_CONF_BIND_STATIC;
+ m = arg_read_only && arg_volatile_mode != VOLATILE_YES ? RESOLV_CONF_BIND_STATIC : RESOLV_CONF_COPY_STATIC;
else if (have_resolv_conf("/etc/resolv.conf") > 0)
m = arg_read_only && arg_volatile_mode != VOLATILE_YES ? RESOLV_CONF_BIND_HOST : RESOLV_CONF_COPY_HOST;
else