1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Implement docker port with standalone client lib.

Signed-off-by: David Calavera <david.calavera@gmail.com>
This commit is contained in:
David Calavera 2015-12-04 11:42:33 -05:00
parent 55333e8f90
commit eeee2eae86

View file

@ -1,7 +1,6 @@
package client
import (
"encoding/json"
"fmt"
"strings"
@ -20,23 +19,11 @@ func (cli *DockerCli) CmdPort(args ...string) error {
cmd.ParseFlags(args, true)
serverResp, err := cli.call("GET", "/containers/"+cmd.Arg(0)+"/json", nil, nil)
c, err := cli.client.ContainerInspect(cmd.Arg(0))
if err != nil {
return err
}
defer serverResp.body.Close()
var c struct {
NetworkSettings struct {
Ports nat.PortMap
}
}
if err := json.NewDecoder(serverResp.body).Decode(&c); err != nil {
return err
}
if cmd.NArg() == 2 {
var (
port = cmd.Arg(1)