Page MenuHomeDevCentral

D1835.diff
No OneTemporary

D1835.diff

diff --git a/cmd/containersps/containersps.go b/cmd/containersps/containersps.go
--- a/cmd/containersps/containersps.go
+++ b/cmd/containersps/containersps.go
@@ -8,6 +8,7 @@
"github.com/docker/docker/client"
"log"
"os"
+ "strings"
)
const DockerApiVersion = "1.37"
@@ -66,5 +67,16 @@
return container.ID[:10]
}
- return names[0][1:]
+ bestCandidate := names[0][1:]
+
+ // Linked containers offer link names before the container name.
+ if strings.Contains(bestCandidate, "/") {
+ for _, name := range names {
+ if !strings.Contains(name[1:], "/") {
+ return name[1:]
+ }
+ }
+ }
+
+ return bestCandidate
}

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 19, 09:52 (20 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2252374
Default Alt Text
D1835.diff (635 B)

Event Timeline