Browse code

Fix port mapping in ps display for public and private Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)

Michael Crosby authored on 2014/05/13 07:26:23
Showing 2 changed files
... ...
@@ -2,11 +2,12 @@ package api
2 2
 
3 3
 import (
4 4
 	"fmt"
5
+	"mime"
6
+	"strings"
7
+
5 8
 	"github.com/dotcloud/docker/engine"
6 9
 	"github.com/dotcloud/docker/pkg/version"
7 10
 	"github.com/dotcloud/docker/utils"
8
-	"mime"
9
-	"strings"
10 11
 )
11 12
 
12 13
 const (
... ...
@@ -30,7 +31,7 @@ func DisplayablePorts(ports *engine.Table) string {
30 30
 	ports.Sort()
31 31
 	for _, port := range ports.Data {
32 32
 		if port.Get("IP") == "" {
33
-			result = append(result, fmt.Sprintf("%d/%s", port.GetInt("PublicPort"), port.Get("Type")))
33
+			result = append(result, fmt.Sprintf("%d/%s", port.GetInt("PrivatePort"), port.Get("Type")))
34 34
 		} else {
35 35
 			result = append(result, fmt.Sprintf("%s:%d->%d/%s", port.Get("IP"), port.GetInt("PublicPort"), port.GetInt("PrivatePort"), port.Get("Type")))
36 36
 		}
... ...
@@ -23,7 +23,7 @@ func (settings *NetworkSettings) PortMappingAPI() *engine.Table {
23 23
 		p, _ := nat.ParsePort(port.Port())
24 24
 		if len(bindings) == 0 {
25 25
 			out := &engine.Env{}
26
-			out.SetInt("PublicPort", p)
26
+			out.SetInt("PrivatePort", p)
27 27
 			out.Set("Type", port.Proto())
28 28
 			outs.Add(out)
29 29
 			continue