mirror of
https://github.com/containers/podman.git
synced 2025-06-22 18:08:11 +08:00
Merge pull request #2478 from baude/portbz1683734
podman port fix output
This commit is contained in:
@ -128,9 +128,6 @@ func portCmd(c *cliconfig.PortValues) error {
|
|||||||
if state, _ := con.State(); state != libpod.ContainerStateRunning {
|
if state, _ := con.State(); state != libpod.ContainerStateRunning {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if c.All {
|
|
||||||
fmt.Println(con.ID())
|
|
||||||
}
|
|
||||||
|
|
||||||
portmappings, err := con.PortMappings()
|
portmappings, err := con.PortMappings()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -143,6 +140,9 @@ func portCmd(c *cliconfig.PortValues) error {
|
|||||||
if hostIP == "" {
|
if hostIP == "" {
|
||||||
hostIP = "0.0.0.0"
|
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 not searching by port or port/proto, then dump what we see
|
||||||
if port == "" {
|
if port == "" {
|
||||||
fmt.Printf("%d/%s -> %s:%d\n", v.ContainerPort, v.Protocol, hostIP, v.HostPort)
|
fmt.Printf("%d/%s -> %s:%d\n", v.ContainerPort, v.Protocol, hostIP, v.HostPort)
|
||||||
|
Reference in New Issue
Block a user