From a4701b56311d5d934543e2b4306b08baa844ec3f Mon Sep 17 00:00:00 2001 From: baude Date: Fri, 19 Jan 2018 08:51:59 -0600 Subject: Add --dns-search, --dns-opt, --dns-server and --add-host. Each of these options are destructive in nature, meaning if the user adds one of them, all current ones are removed from the produced resolv.conf. * dns-server allows the user to specify dns servers. * dns-opt allows the user to specify special resolv.conf options * dns-search allows the user to specify search domains The add-host option is not destructive and truly just adds the host to /etc/hosts. Signed-off-by: baude Closes: #231 Approved by: mheon --- libpod/container_api.go | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'libpod/container_api.go') diff --git a/libpod/container_api.go b/libpod/container_api.go index 9a4f50079..be7fd76bc 100644 --- a/libpod/container_api.go +++ b/libpod/container_api.go @@ -79,22 +79,15 @@ func (c *Container) Init() (err error) { } // Copy /etc/resolv.conf to the container's rundir - 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) + runDirResolv, err := c.generateResolvConf() if err != nil { - return errors.Wrapf(err, "unable to copy resolv.conf to ", runDirResolv) + return err } + // Copy /etc/hosts to the container's rundir - runDirHosts, err := c.copyHostFileToRundir("/etc/hosts") + runDirHosts, err := c.generateHosts() if err != nil { - return errors.Wrapf(err, "unable to copy /etc/hosts to ", runDirHosts) + return errors.Wrapf(err, "unable to copy /etc/hosts to container space") } // Save OCI spec to disk -- cgit v1.2.3-54-g00ecf