From 2f52bd04e625adc0ed0bd63544b1a188b216b14e Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Mon, 10 Oct 2022 20:10:36 -0700 Subject: [PATCH] properly display unforwarded port --- pkg/commands/container.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/commands/container.go b/pkg/commands/container.go index c239640d..39cece20 100644 --- a/pkg/commands/container.go +++ b/pkg/commands/container.go @@ -57,6 +57,10 @@ func (c *Container) GetDisplayStrings(isFocused bool) []string { func (c *Container) displayPorts() string { portStrings := lo.Map(c.Container.Ports, func(port types.Port, _ int) string { + if port.PublicPort == 0 { + return fmt.Sprintf("%d\\%s", port.PrivatePort, port.Type) + } + // docker ps will show '0.0.0.0:80->80/tcp' but we'll show // '80->80/tcp' instead to save space (unless the IP is something other than // 0.0.0.0)