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:
David Calavera
2015-07-21 15:48:51 -07:00
11 changed files with 128 additions and 37 deletions
+5 -1
View File
@@ -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)
}