diff options
author | Matthew Heon <mheon@redhat.com> | 2020-05-08 17:58:00 -0400 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2020-05-08 18:00:42 -0400 |
commit | 8238b7e70688e637d58305287a19e4080f619587 (patch) | |
tree | 5b533f6a5ab5668391ae564bad5ed691604753a2 /libpod/container_inspect.go | |
parent | c57c560d9014b38040df8529f09208ba7743f794 (diff) | |
download | podman-8238b7e70688e637d58305287a19e4080f619587.tar.gz podman-8238b7e70688e637d58305287a19e4080f619587.tar.bz2 podman-8238b7e70688e637d58305287a19e4080f619587.zip |
Ensure `podman inspect` output for NetworkMode is right
I realized that setting NetworkMode to private when we are making
a network namespace but not configuring it with CNI or Slirp is
wrong; that's considered `--net=none` not `--net=private`. At the
same time, realized that we actually store whether Slirp is in
use, so we can be more specific than just "default" and instead
say slirp4netns or bridge.
Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'libpod/container_inspect.go')
-rw-r--r-- | libpod/container_inspect.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libpod/container_inspect.go b/libpod/container_inspect.go index a42b50609..b26dcddf6 100644 --- a/libpod/container_inspect.go +++ b/libpod/container_inspect.go @@ -580,7 +580,10 @@ func (c *Container) generateInspectContainerHostConfig(ctrSpec *spec.Spec, named networkMode := "" switch { case c.config.CreateNetNS: - networkMode = "default" + // We actually store the network + // mode for Slirp and Bridge, so + // we can just use that + networkMode = string(c.config.NetMode) case c.config.NetNsCtr != "": networkMode = fmt.Sprintf("container:%s", c.config.NetNsCtr) default: @@ -594,7 +597,10 @@ func (c *Container) generateInspectContainerHostConfig(ctrSpec *spec.Spec, named if ns.Path != "" { networkMode = fmt.Sprintf("ns:%s", ns.Path) } else { - networkMode = "private" + // We're making a network ns, but not + // configuring with Slirp or CNI. That + // means it's --net=none + networkMode = "none" } break } |