diff options
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/common/netflags.go | 2 | ||||
-rw-r--r-- | cmd/podman/containers/create.go | 6 |
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() |