mirror of
https://github.com/containers/podman.git
synced 2025-10-17 03:04:21 +08:00
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>
This commit is contained in:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user