summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-01-02 13:53:08 -0600
committerAtomic Bot <atomic-devel@projectatomic.io>2018-01-02 21:22:07 +0000
commit8aeb38e4a718925a78606b8aa014bce6b4a4054c (patch)
tree400c5491d48e8c89a5481b1c23a1cb4e4861893d
parentde6d5b75ac8baa6871991984dc8dcf9b702b8a9e (diff)
downloadpodman-8aeb38e4a718925a78606b8aa014bce6b4a4054c.tar.gz
podman-8aeb38e4a718925a78606b8aa014bce6b4a4054c.tar.bz2
podman-8aeb38e4a718925a78606b8aa014bce6b4a4054c.zip
libpod/container.go Handle systemd resolve
In cases, like Ubuntu, where it uses systemd resolve for DNS then do not copy /etc/resolv.conf but instead the resolv.conf in the systemd resolve /run dir. Signed-off-by: baude <bbaude@redhat.com> Closes: #177 Approved by: rhatdan
-rw-r--r--libpod/container.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/libpod/container.go b/libpod/container.go
index 158bf7529..454fe43ac 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -584,9 +584,17 @@ func (c *Container) Init() (err error) {
}
// Copy /etc/resolv.conf to the container's rundir
- runDirResolv, err := c.copyHostFileToRundir("/etc/resolv.conf")
+ resolvPath := "/etc/resolv.conf"
+
+ // Check if the host system is using system resolve and if so
+ // copy its resolv.conf
+ _, err = os.Stat("/run/systemd/resolve/resolv.conf")
+ if err == nil {
+ resolvPath = "/run/systemd/resolve/resolv.conf"
+ }
+ runDirResolv, err := c.copyHostFileToRundir(resolvPath)
if err != nil {
- return errors.Wrapf(err, "unable to copy /etc/resolv.conf to ", runDirResolv)
+ return errors.Wrapf(err, "unable to copy resolv.conf to ", runDirResolv)
}
// Copy /etc/hosts to the container's rundir
runDirHosts, err := c.copyHostFileToRundir("/etc/hosts")