-
Notifications
You must be signed in to change notification settings - Fork 2.1k
docs: update docker cp --archive flag description to match source #6939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
0015f6c
cbeeefe
397a379
044dea2
e2abd26
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -364,6 +364,24 @@ func DisplayablePorts(ports []container.PortSummary) string { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var result []string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var hostMappings []string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var groupMapKeys []string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Pre-pass: record which (hostPort, privatePort, proto) tuples have an | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // IPv4 wildcard (0.0.0.0) binding. Used below to suppress the matching | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // IPv6 wildcard (::) entry, avoiding duplicate output such as: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 0.0.0.0:8080->80/tcp, :::8080->80/tcp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // See: https://github.com/docker/cli/issues/6869 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+368
to
+372
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type mappingKey struct { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| hostPort uint16 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| privatePort uint16 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| proto string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ipv4Bindings := make(map[mappingKey]bool) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for _, port := range ports { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if port.IP.String() == "0.0.0.0" && port.PublicPort != 0 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if port.IP.String() == "0.0.0.0" && port.PublicPort != 0 { | |
| if port.IP.Is4() && port.IP.IsUnspecified() && port.PublicPort != 0 { |
Copilot
AI
Apr 18, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New behavior to suppress IPv6 wildcard bindings when an IPv4 wildcard exists isn’t covered by existing TestDisplayablePorts cases. Please add a test case exercising a dual-stack wildcard publish (e.g., 0.0.0.0:8080->80/tcp plus :::8080->80/tcp, and also consider -p 80:80 where PublicPort == PrivatePort) to prevent regressions.
| if port.PublicPort != current { | |
| // Suppress the IPv6 wildcard entry when an IPv4 wildcard | |
| // entry already covers the same (hostPort, privatePort, proto) | |
| // tuple. This merges: | |
| // 0.0.0.0:8080->80/tcp, :::8080->80/tcp | |
| // into the cleaner: | |
| // 0.0.0.0:8080->80/tcp | |
| if port.IP.Is6() && !port.IP.Is4In6() && port.IP.IsUnspecified() { | |
| key := mappingKey{port.PublicPort, port.PrivatePort, port.Type} | |
| if ipv4Bindings[key] { | |
| continue | |
| } | |
| } | |
| // Suppress the IPv6 wildcard entry when an IPv4 wildcard | |
| // entry already covers the same (hostPort, privatePort, proto) | |
| // tuple. This merges: | |
| // 0.0.0.0:8080->80/tcp, :::8080->80/tcp | |
| // into the cleaner: | |
| // 0.0.0.0:8080->80/tcp | |
| // | |
| // Apply this before choosing the output format so it also | |
| // suppresses dual-stack wildcard publishes where | |
| // PublicPort == PrivatePort (for example: -p 80:80). | |
| if port.IP.Is6() && !port.IP.Is4In6() && port.IP.IsUnspecified() { | |
| key := mappingKey{port.PublicPort, port.PrivatePort, port.Type} | |
| if ipv4Bindings[key] { | |
| continue | |
| } | |
| } | |
| if port.PublicPort != current { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description says the generated docs were updated to match the existing flag description in
cli/command/container/cp.go, but this PR also changes the flag description string incp.go. Please update the PR description (or split commits) so it’s clear whether the source-of-truth changed vs. docs-only regeneration.