Skip to content

Commit 53a24c6

Browse files
authored
cli/cli/port: use len() to check frontends ports
This ensure the command won't print an empty output if the `frontends` port is nil
1 parent 75a5713 commit 53a24c6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cli/command/container/port.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func runPort(ctx context.Context, dockerCli command.Cli, opts *portOptions) erro
6868
return errors.Wrapf(err, "Error: invalid port (%s)", port)
6969
}
7070
frontends, exists := c.NetworkSettings.Ports[nat.Port(port+"/"+proto)]
71-
if !exists || frontends == nil {
71+
if !exists || len(frontends) == 0 {
7272
return errors.Errorf("Error: No public port '%s' published for %s", opts.port, opts.container)
7373
}
7474
for _, frontend := range frontends {

0 commit comments

Comments
 (0)