summaryrefslogtreecommitdiff
path: root/libpod/container_api.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-01-19 08:51:59 -0600
committerAtomic Bot <atomic-devel@projectatomic.io>2018-01-19 15:42:25 +0000
commita4701b56311d5d934543e2b4306b08baa844ec3f (patch)
treebcad38f7cf02a37107bfa61854a01eb58bf9868f /libpod/container_api.go
parent1710acd18a4630ef704c66bf0cdae76dd658776a (diff)
downloadpodman-a4701b56311d5d934543e2b4306b08baa844ec3f.tar.gz
podman-a4701b56311d5d934543e2b4306b08baa844ec3f.tar.bz2
podman-a4701b56311d5d934543e2b4306b08baa844ec3f.zip
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 <bbaude@redhat.com> Closes: #231 Approved by: mheon
Diffstat (limited to 'libpod/container_api.go')
-rw-r--r--libpod/container_api.go17
1 files changed, 5 insertions, 12 deletions
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