summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-02-26 06:35:39 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2021-02-26 06:37:48 -0500
commit680dacaea2c7c8150cb2a8c9770a6e981a1f5ebc (patch)
treef9e448591b1562dc7d1f1dffa6dc8bfaf0c21c9b /cmd/podman
parent05410e81efec2ef2398f740b81610fbad73b7bf2 (diff)
downloadpodman-680dacaea2c7c8150cb2a8c9770a6e981a1f5ebc.tar.gz
podman-680dacaea2c7c8150cb2a8c9770a6e981a1f5ebc.tar.bz2
podman-680dacaea2c7c8150cb2a8c9770a6e981a1f5ebc.zip
Enable no_hosts from containers.conf
Since we have no good way to enable this on the server side, we will just allow it to be set on the client side. This should solve almost all cases. Partially fixes: https://github.com/containers/podman/issues/9500 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/common/netflags.go2
-rw-r--r--cmd/podman/containers/create.go6
2 files changed, 6 insertions, 2 deletions
diff --git a/cmd/podman/common/netflags.go b/cmd/podman/common/netflags.go
index bc4d54de0..4d0a554a6 100644
--- a/cmd/podman/common/netflags.go
+++ b/cmd/podman/common/netflags.go
@@ -80,7 +80,7 @@ func DefineNetFlags(cmd *cobra.Command) {
_ = cmd.RegisterFlagCompletionFunc(publishFlagName, completion.AutocompleteNone)
netFlags.Bool(
- "no-hosts", false,
+ "no-hosts", containerConfig.Containers.NoHosts,
"Do not create /etc/hosts within the container, instead use the version from the image",
)
}
diff --git a/cmd/podman/containers/create.go b/cmd/podman/containers/create.go
index d7507775f..af9278ce1 100644
--- a/cmd/podman/containers/create.go
+++ b/cmd/podman/containers/create.go
@@ -166,7 +166,11 @@ func createInit(c *cobra.Command) error {
return errors.Errorf("--cpu-quota and --cpus cannot be set together")
}
- if c.Flag("no-hosts").Changed && c.Flag("add-host").Changed {
+ noHosts, err := c.Flags().GetBool("no-hosts")
+ if err != nil {
+ return err
+ }
+ if noHosts && c.Flag("add-host").Changed {
return errors.Errorf("--no-hosts and --add-host cannot be set together")
}
cliVals.UserNS = c.Flag("userns").Value.String()