From 236300d02832b1c131e5d70f3510e5169857b69b Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Mon, 25 Mar 2019 12:12:18 -0400 Subject: Add --no-hosts flag to disable management of /etc/hosts Signed-off-by: Matthew Heon --- pkg/spec/createconfig.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pkg/spec') diff --git a/pkg/spec/createconfig.go b/pkg/spec/createconfig.go index fba69d1ba..15719beab 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 @@ -514,7 +515,10 @@ func (c *CreateConfig) GetContainerCreateOptions(runtime *libpod.Runtime, pod *l if len(c.DNSOpt) > 0 { options = append(options, libpod.WithDNSOption(c.DNSOpt)) } - if len(c.HostAdd) > 0 { + if c.NoHosts { + options = append(options, libpod.WithNoCreateHosts()) + } + if len(c.HostAdd) > 0 && !c.NoHosts { options = append(options, libpod.WithHosts(c.HostAdd)) } logPath := getLoggingPath(c.LogDriverOpt) -- cgit v1.2.3-54-g00ecf