summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-03-27 10:49:42 -0700
committerGitHub <noreply@github.com>2019-03-27 10:49:42 -0700
commit340eeec1b654880f9d339c9ac2957bcaeaee6829 (patch)
tree4256daeae13e2de6145d3b5c5be5f1929e955bbc /pkg
parent1ff03ee9f5e72fd62ba8e798035fa43f8f18b6dd (diff)
parent0cd92eae65b31cdbaa19e3cccb0e3234196a6d17 (diff)
downloadpodman-340eeec1b654880f9d339c9ac2957bcaeaee6829.tar.gz
podman-340eeec1b654880f9d339c9ac2957bcaeaee6829.tar.bz2
podman-340eeec1b654880f9d339c9ac2957bcaeaee6829.zip
Merge pull request #2747 from mheon/dns_none
Add --dns=none
Diffstat (limited to 'pkg')
-rw-r--r--pkg/spec/createconfig.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/pkg/spec/createconfig.go b/pkg/spec/createconfig.go
index 118fbad72..79a318771 100644
--- a/pkg/spec/createconfig.go
+++ b/pkg/spec/createconfig.go
@@ -88,6 +88,7 @@ type CreateConfig struct {
ExposedPorts map[nat.Port]struct{}
GroupAdd []string // group-add
HealthCheck *manifest.Schema2HealthConfig
+ NoHosts bool
HostAdd []string //add-host
Hostname string //hostname
Image string
@@ -505,12 +506,19 @@ func (c *CreateConfig) GetContainerCreateOptions(runtime *libpod.Runtime, pod *l
options = append(options, libpod.WithDNSSearch(c.DNSSearch))
}
if len(c.DNSServers) > 0 {
- options = append(options, libpod.WithDNS(c.DNSServers))
+ if len(c.DNSServers) == 1 && strings.ToLower(c.DNSServers[0]) == "none" {
+ options = append(options, libpod.WithUseImageResolvConf())
+ } else {
+ options = append(options, libpod.WithDNS(c.DNSServers))
+ }
}
if len(c.DNSOpt) > 0 {
options = append(options, libpod.WithDNSOption(c.DNSOpt))
}
- if len(c.HostAdd) > 0 {
+ if c.NoHosts {
+ options = append(options, libpod.WithUseImageHosts())
+ }
+ if len(c.HostAdd) > 0 && !c.NoHosts {
options = append(options, libpod.WithHosts(c.HostAdd))
}
logPath := getLoggingPath(c.LogDriverOpt)