diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-03-01 08:12:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-01 08:12:48 +0100 |
commit | 3417703a063cc71de60752836daf2ffec158d2f6 (patch) | |
tree | a6a1fe2ce80c30167c4f23850bdd19e474d236f3 /cmd | |
parent | 9600ea6bef8000b0c45407409124c7df21050493 (diff) | |
parent | 680dacaea2c7c8150cb2a8c9770a6e981a1f5ebc (diff) | |
download | podman-3417703a063cc71de60752836daf2ffec158d2f6.tar.gz podman-3417703a063cc71de60752836daf2ffec158d2f6.tar.bz2 podman-3417703a063cc71de60752836daf2ffec158d2f6.zip |
Merge pull request #9527 from rhatdan/hosts
Enable no_hosts from containers.conf
Diffstat (limited to 'cmd')
-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() |