Merge pull request #6063 from giautm/patch-1

cli/cli: use `len()` to check frontend ports in the `port` command
This commit is contained in:
Sebastiaan van Stijn
2025-05-16 12:03:15 +02:00
committed by GitHub
+1 -1
View File
@@ -68,7 +68,7 @@ func runPort(ctx context.Context, dockerCli command.Cli, opts *portOptions) erro
return errors.Wrapf(err, "Error: invalid port (%s)", port)
}
frontends, exists := c.NetworkSettings.Ports[nat.Port(port+"/"+proto)]
if !exists || frontends == nil {
if !exists || len(frontends) == 0 {
return errors.Errorf("Error: No public port '%s' published for %s", opts.port, opts.container)
}
for _, frontend := range frontends {