summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2020-06-24 15:55:09 -0400
committerMatthew Heon <mheon@redhat.com>2020-06-25 15:35:58 -0400
commitdc22350be5f59f612342bc53ec9689f0b2c2145a (patch)
tree3f6534a068d2ec65feb248c9d16fe6c9000ba640 /pkg
parent48ce67fb5630e67f17f2460b30a0f9cddc21ab8f (diff)
downloadpodman-dc22350be5f59f612342bc53ec9689f0b2c2145a.tar.gz
podman-dc22350be5f59f612342bc53ec9689f0b2c2145a.tar.bz2
podman-dc22350be5f59f612342bc53ec9689f0b2c2145a.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(),