Merge pull request #14682 from duglin/Issue14621
Remove panic in nat package on invalid hostport Upstream-commit: 36106a20cacb8f96b64da303f651bbd2160e24e3 Component: engine
This commit is contained in:
@@ -48,7 +48,11 @@ func (cli *DockerCli) CmdPort(args ...string) error {
|
||||
proto = parts[1]
|
||||
}
|
||||
natPort := port + "/" + proto
|
||||
if frontends, exists := c.NetworkSettings.Ports[nat.Port(port+"/"+proto)]; exists && frontends != nil {
|
||||
newP, err := nat.NewPort(proto, port)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if frontends, exists := c.NetworkSettings.Ports[newP]; exists && frontends != nil {
|
||||
for _, frontend := range frontends {
|
||||
fmt.Fprintf(cli.out, "%s:%s\n", frontend.HostIp, frontend.HostPort)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user