Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3754782
D1835.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
635 B
Referenced Files
None
Subscribers
None
D1835.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D1835: Prefer container name to linked name
Attached
Detach File
Event Timeline
Log In to Comment