Skip to content

Commit 77fbbc3

Browse files
authored
Merge pull request #6063 from giautm/patch-1
cli/cli: use `len()` to check frontend ports in the `port` command
2 parents bca09c7 + c409383 commit 77fbbc3

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)