diff options
author | Matthew Heon <matthew.heon@pm.me> | 2020-06-24 15:55:09 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2020-06-24 17:27:26 -0400 |
commit | 16b3356a89ba97ec4d7752d43dfe2e695cf4ca82 (patch) | |
tree | eab00acd37aa6934c69eb81bb1f529165d001f58 /pkg/ps/ps.go | |
parent | 4ee66598c1201a7d191c03c2d2f067f847aaddf5 (diff) | |
download | podman-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/ps/ps.go')
-rw-r--r-- | pkg/ps/ps.go | 8 |
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(), |