mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fix port mapping in ps display for public and private
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
parent
bc77ec2b17
commit
d54dec4d8b
2 changed files with 5 additions and 4 deletions
|
@ -2,11 +2,12 @@ package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"mime"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/dotcloud/docker/engine"
|
"github.com/dotcloud/docker/engine"
|
||||||
"github.com/dotcloud/docker/pkg/version"
|
"github.com/dotcloud/docker/pkg/version"
|
||||||
"github.com/dotcloud/docker/utils"
|
"github.com/dotcloud/docker/utils"
|
||||||
"mime"
|
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -30,7 +31,7 @@ func DisplayablePorts(ports *engine.Table) string {
|
||||||
ports.Sort()
|
ports.Sort()
|
||||||
for _, port := range ports.Data {
|
for _, port := range ports.Data {
|
||||||
if port.Get("IP") == "" {
|
if port.Get("IP") == "" {
|
||||||
result = append(result, fmt.Sprintf("%d/%s", port.GetInt("PublicPort"), port.Get("Type")))
|
result = append(result, fmt.Sprintf("%d/%s", port.GetInt("PrivatePort"), port.Get("Type")))
|
||||||
} else {
|
} else {
|
||||||
result = append(result, fmt.Sprintf("%s:%d->%d/%s", port.Get("IP"), port.GetInt("PublicPort"), port.GetInt("PrivatePort"), port.Get("Type")))
|
result = append(result, fmt.Sprintf("%s:%d->%d/%s", port.Get("IP"), port.GetInt("PublicPort"), port.GetInt("PrivatePort"), port.Get("Type")))
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ func (settings *NetworkSettings) PortMappingAPI() *engine.Table {
|
||||||
p, _ := nat.ParsePort(port.Port())
|
p, _ := nat.ParsePort(port.Port())
|
||||||
if len(bindings) == 0 {
|
if len(bindings) == 0 {
|
||||||
out := &engine.Env{}
|
out := &engine.Env{}
|
||||||
out.SetInt("PublicPort", p)
|
out.SetInt("PrivatePort", p)
|
||||||
out.Set("Type", port.Proto())
|
out.Set("Type", port.Proto())
|
||||||
outs.Add(out)
|
outs.Add(out)
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Add table
Reference in a new issue