summaryrefslogtreecommitdiff
path: root/libpod/container_inspect.go
diff options
context:
space:
mode:
authoropenshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com>2021-07-30 15:48:14 +0000
committerGitHub <noreply@github.com>2021-07-30 15:48:14 +0000
commitaaf02cfbd41e7d7fbd009a4f01a0fa45b3e49f61 (patch)
tree997bf585beb9bbfa97878a425b693a40cbc64568 /libpod/container_inspect.go
parent4429c7c713677a304a5ea62eec3cd1524bd2ce3f (diff)
parent2a484e782a23ad67c98e22121fde2b83b4072d1a (diff)
downloadpodman-aaf02cfbd41e7d7fbd009a4f01a0fa45b3e49f61.tar.gz
podman-aaf02cfbd41e7d7fbd009a4f01a0fa45b3e49f61.tar.bz2
podman-aaf02cfbd41e7d7fbd009a4f01a0fa45b3e49f61.zip
Merge pull request #11075 from flouthoc/ps-filter-network-by-container
ps: support the `container...` notation for `ps --filter network=...`
Diffstat (limited to 'libpod/container_inspect.go')
-rw-r--r--libpod/container_inspect.go33
1 files changed, 1 insertions, 32 deletions
diff --git a/libpod/container_inspect.go b/libpod/container_inspect.go
index 638e0b756..8c662c488 100644
--- a/libpod/container_inspect.go
+++ b/libpod/container_inspect.go
@@ -618,38 +618,7 @@ func (c *Container) generateInspectContainerHostConfig(ctrSpec *spec.Spec, named
hostConfig.Tmpfs = tmpfs
// Network mode parsing.
- networkMode := ""
- switch {
- case c.config.CreateNetNS:
- // 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:
- // Find the spec's network namespace.
- // If there is none, it's host networking.
- // If there is one and it has a path, it's "ns:".
- foundNetNS := false
- for _, ns := range ctrSpec.Linux.Namespaces {
- if ns.Type == spec.NetworkNamespace {
- foundNetNS = true
- if ns.Path != "" {
- networkMode = fmt.Sprintf("ns:%s", ns.Path)
- } else {
- // We're making a network ns, but not
- // configuring with Slirp or CNI. That
- // means it's --net=none
- networkMode = "none"
- }
- break
- }
- }
- if !foundNetNS {
- networkMode = "host"
- }
- }
+ networkMode := c.NetworkMode()
hostConfig.NetworkMode = networkMode
// Port bindings.