summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2020-06-24 15:55:09 -0400
committerMatthew Heon <matthew.heon@pm.me>2020-06-24 17:27:26 -0400
commit16b3356a89ba97ec4d7752d43dfe2e695cf4ca82 (patch)
treeeab00acd37aa6934c69eb81bb1f529165d001f58 /pkg
parent4ee66598c1201a7d191c03c2d2f067f847aaddf5 (diff)
downloadpodman-16b3356a89ba97ec4d7752d43dfe2e695cf4ca82.tar.gz
podman-16b3356a89ba97ec4d7752d43dfe2e695cf4ca82.tar.bz2
podman-16b3356a89ba97ec4d7752d43dfe2e695cf4ca82.zip
Print port mappings in `ps` for ctrs sharing network
In Podman v1.9, we printed port mappings for the container, even if it shared its network namespace (and thus ports) with another container. We regressed on this in Podman v2.0, which is fixed here. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/ps/ps.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/pkg/ps/ps.go b/pkg/ps/ps.go
index b07eb7f9a..cbac2cb06 100644
--- a/pkg/ps/ps.go
+++ b/pkg/ps/ps.go
@@ -145,11 +145,15 @@ func ListContainerBatch(rt *libpod.Runtime, ctr *libpod.Container, opts entities
}
return nil
})
-
if batchErr != nil {
return entities.ListContainer{}, batchErr
}
+ portMappings, err := ctr.PortMappings()
+ if err != nil {
+ return entities.ListContainer{}, err
+ }
+
ps := entities.ListContainer{
Command: conConfig.Command,
Created: conConfig.CreatedTime.Unix(),
@@ -165,7 +169,7 @@ func ListContainerBatch(rt *libpod.Runtime, ctr *libpod.Container, opts entities
Names: []string{conConfig.Name},
Pid: pid,
Pod: conConfig.Pod,
- Ports: conConfig.PortMappings,
+ Ports: portMappings,
Size: size,
StartedAt: startedTime.Unix(),
State: conState.String(),