summaryrefslogtreecommitdiff
path: root/cmd/podman/shared/container.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-02-13 13:22:58 -0600
committerbaude <bbaude@redhat.com>2019-02-13 13:51:23 -0600
commitdd74467fd8dcbdab35b4c7fc2dc183d12fb228f2 (patch)
tree647d88b335a6da3e6fbdf481694223fd9b7c8026 /cmd/podman/shared/container.go
parent8a16f83b0a13ab9de1cc905a3ff1132c75739995 (diff)
downloadpodman-dd74467fd8dcbdab35b4c7fc2dc183d12fb228f2.tar.gz
podman-dd74467fd8dcbdab35b4c7fc2dc183d12fb228f2.tar.bz2
podman-dd74467fd8dcbdab35b4c7fc2dc183d12fb228f2.zip
show container ports of network namespace
in cases where a container is part of a network namespace, we should show the network namespace's ports when dealing with ports. this impacts ps, kube, and port. fixes: #846 Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podman/shared/container.go')
-rw-r--r--cmd/podman/shared/container.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/cmd/podman/shared/container.go b/cmd/podman/shared/container.go
index c74d8fdce..81811e0f2 100644
--- a/cmd/podman/shared/container.go
+++ b/cmd/podman/shared/container.go
@@ -213,11 +213,16 @@ func NewBatchContainer(ctr *libpod.Container, opts PsOptions) (PsContainerOutput
}
}
+ ports, err := ctr.PortMappings()
+ if err != nil {
+ logrus.Errorf("unable to lookup namespace container for %s", ctr.ID())
+ }
+
pso.ID = cid
pso.Image = imageName
pso.Command = command
pso.Created = created
- pso.Ports = portsToString(ctr.PortMappings())
+ pso.Ports = portsToString(ports)
pso.Names = ctr.Name()
pso.IsInfra = ctr.IsInfra()
pso.Status = status