summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-02-27 20:31:01 -0600
committerbaude <bbaude@redhat.com>2019-02-27 20:31:01 -0600
commit3eb1d3c08a05d8cbdcdb7ce9594339b142a679d7 (patch)
treeacb37476693c77c3c93f24f0c5820c653c88d62f
parent6f0dbd004fecadb6d0d07bb8012231d25d61684f (diff)
downloadpodman-3eb1d3c08a05d8cbdcdb7ce9594339b142a679d7.tar.gz
podman-3eb1d3c08a05d8cbdcdb7ce9594339b142a679d7.tar.bz2
podman-3eb1d3c08a05d8cbdcdb7ce9594339b142a679d7.zip
podman port fix output
list a portion of the container id and the ports exposed on the same line. when using all, if no ports are exposed, do not list the container id. Also, shorten the container id to a len of 12 like other container commands. Fixes bugzilla #1683734 Signed-off-by: baude <bbaude@redhat.com>
-rw-r--r--cmd/podman/port.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/cmd/podman/port.go b/cmd/podman/port.go
index 1c3086536..ffb5749fb 100644
--- a/cmd/podman/port.go
+++ b/cmd/podman/port.go
@@ -128,9 +128,6 @@ func portCmd(c *cliconfig.PortValues) error {
if state, _ := con.State(); state != libpod.ContainerStateRunning {
continue
}
- if c.All {
- fmt.Println(con.ID())
- }
portmappings, err := con.PortMappings()
if err != nil {
@@ -143,6 +140,9 @@ func portCmd(c *cliconfig.PortValues) error {
if hostIP == "" {
hostIP = "0.0.0.0"
}
+ if c.All {
+ fmt.Printf("%s\t", con.ID()[:12])
+ }
// If not searching by port or port/proto, then dump what we see
if port == "" {
fmt.Printf("%d/%s -> %s:%d\n", v.ContainerPort, v.Protocol, hostIP, v.HostPort)