Sebastiaan van Stijn
c88268681e
prevent login prompt on registry operations with no TTY attached
...
When pulling or pushing images, the CLI could prompt for a password
if the push/pull failed and the registry returned a 401 (Unauthorized)
Ironically, this feature did not work when using Docker Hub (and possibly
other registries using basic auth), due to some custom error handling added
in [moby@19a93a6e3d42], which also discards the registry's status code,
changing it to a 404;
curl -v -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.50/images/create?fromImage=docker.io%2Fexample%2Fprivate&tag=latest '
...
< HTTP/1.1 404 Not Found
< Content-Type: application/json
...
{"message":"pull access denied for example/private, repository does not exist or may require 'docker login'"}
And due to a bug, other registries (not using basic auth) returned a generic
error, which resulted in a 500 Internal Server Error. That bug was fixed in
docker 28.2, now returning the upstream status code and trigger an interactive
prompt;
docker pull icr.io/my-ns/my-image:latest
Please login prior to pull:
Username:
This prompt would be triggered unconditionally, also if the CLI was run
non-interactively and no TTY attached;
docker pull icr.io/my-ns/my-image:latest < /dev/null
Please login prior to pull:
Username:
With this PR, no prompt is shown ;
# without STDIN attached
docker pull icr.io/my-ns/my-image:latest < /dev/null
Error response from daemon: error from registry: Authorization required. See https://cloud.ibm.com/docs/Registry?topic=Registry-troubleshoot-auth-req - Authorization required. See https://cloud.ibm.com/docs/Registry?topic=Registry-troubleshoot-auth-req
For now, the prompt is still shown otherwise;
docker pull icr.io/my-ns/my-image:latest
Login prior to pull:
Username: ^C
[moby@19a93a6e3d42]: https://github.com/moby/moby/commit/19a93a6e3d4213c56583bb0c843cf9e33d379752
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-06-19 10:25:27 +02:00
Paweł Gronowski
23fe9ec244
image/tree: Fix top image chip detection
...
Currently, image tree visualization doesn't properly detect chips for
parent images, only looking at child images. This patch fixes the issue
by checking both parent and child images when determining which chips to
display in the tree view.
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com >
2025-06-18 20:18:58 +02:00
Sebastiaan van Stijn
50da0ad9df
cli/command/container: remove use of ExecOptions.Detach as intermediate
...
This field was added in [moby@5130fe5d38837302e], which
added it for use as intermediate struct when parsing CLI flags (through
`runconfig.ParseExec`) in [moby@c786a8ee5e9db8f5f].
Commit [moby@9d9dff3d0d9e92adf] rewrote the CLI to use
Cobra, and as part of this introduced a separate `execOptions` type in
`api/client/container`, however the ExecOptions.Detach field was still
used as intermediate field to store the flag's value.
Given that the client doesn't use this field, let's remove its use to
prevent giving the impression that it's used anywhere.
[moby@5130fe5d38837302e]: https://github.com/docker/docker/commit/5130fe5d38837302e72bdc5e4bd1f5fa1df72c7f
[moby@c786a8ee5e9db8f5f]: https://github.com/docker/docker/commit/c786a8ee5e9db8f5f609cf8721bd1e1513fb0043
[moby@9d9dff3d0d9e92adf]: https://github.com/docker/docker/commit/9d9dff3d0d9e92adf7c2e59f94c63766659d1d47
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-06-17 12:53:44 +02:00
Sebastiaan van Stijn
e2632c5c4f
cli/command: RegistryAuthenticationPrivilegedFunc: fix hints for login
...
The RegistryAuthenticationPrivilegedFunc has some conditional logic to
add additional hints when logging in to the default (Docker Hub) registry.
Commit 9f4165ccb8 inadvertently passed the
wrong variable to PromptUserForCredentials, which caused it to show the
additional hints for Docker Hub.
Before this patch, hints were printed for the default (docker hub) registry;
docker pull icr.io/my-ns/my-image:latest
Login prior to pull:
Log in with your Docker ID or email address to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com/ to create one.
You can log in with your password or a Personal Access Token (PAT). Using a limited-scope PAT grants better security and is required for organizations using SSO. Learn more at https://docs.docker.com/go/access-tokens/
Username:
With this patch, those hints are omitted;
docker pull icr.io/my-ns/my-image:latest
Login prior to pull:
Username:
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-06-16 12:14:53 +02:00
Sebastiaan van Stijn
99d4d1f386
cli/command/container: replace uses of deprecated event.Status field
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-06-13 18:18:28 +02:00
Sebastiaan van Stijn
bb0ca9f9ef
image rm: add --platform option
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-27 10:58:11 +02:00
Sebastiaan van Stijn
ae922ec177
Merge pull request #6092 from thaJeztah/hijack_oncefunc
...
cli/command/container: hijackedIOStreamer.setupInput: use sync.OnceFunc
2025-05-22 10:02:11 +02:00
Alano Terblanche
761285bfee
feat: relative parent paths on bind mount src
...
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com >
2025-05-22 08:15:32 +02:00
Sebastiaan van Stijn
4be9afb801
Merge pull request #6086 from thaJeztah/golangci_tweaks
...
golangci-lint: enable more linters, and some minor linting fixes
2025-05-22 07:57:53 +02:00
Sebastiaan van Stijn
0ee20b8543
Merge pull request #5995 from vvoland/swarm-init-cacert
...
swarm/init: Fix `--external-ca` ignoring `cacert` option
2025-05-21 18:31:14 +02:00
Sebastiaan van Stijn
bf2eea31b5
cli/command/container: hijackedIOStreamer.setupInput: use sync.OnceFunc
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-21 17:34:51 +02:00
Sebastiaan van Stijn
6e4315f599
search: remove deprecated "IsAutomated" placeholder
...
IsAutomated was deprecated in 4fc3f0e6f6
(docker v25.0), and marked for removal in docker 26.0 (which we missed).
This removes it.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-21 17:13:59 +02:00
Sebastiaan van Stijn
67c0be4b05
docker ps: allow formatting as JSON
...
With this patch:
docker ps --format 'table {{.Names}}\t{{.Platform}}'
NAMES PLATFORM
optimistic_nightingale linux/arm64
mycontainer linux/arm64/v8
trusting_goldstine linux/arm64
docker ps --format '{{.Platform}}'
linux/arm64
linux/arm64/v8
linux/arm64
docker ps --format '{{json .Platform}}'
{"architecture":"arm64","os":"linux"}
{"architecture":"arm64","os":"linux","variant":"v8"}
{"architecture":"arm64","os":"linux"}
docker ps --format 'json'
{"Command":"\"/bin/bash\"","CreatedAt":"2025-05-13 10:12:19 +0000 UTC","ID":"e8b3b2d604f1","Image":"docker-cli-dev","Labels":"desktop.docker.io/binds/0/Source=/Users/thajeztah/go/src/github.com/docker/cli,desktop.docker.io/binds/0/SourceKind=hostFile,desktop.docker.io/binds/0/Target=/go/src/github.com/docker/cli,desktop.docker.io/mounts/0/Source=/var/run/docker.sock,desktop.docker.io/mounts/0/SourceKind=dockerSocketProxied,desktop.docker.io/mounts/0/Target=/var/run/docker.sock,desktop.docker.io/ports.scheme=v2","LocalVolumes":"1","Mounts":"/host_mnt/User…,docker-cli-dev…,/run/host-serv…","Names":"optimistic_nightingale","Networks":"bridge","Platform":{"architecture":"arm64","os":"linux"},"Ports":"","RunningFor":"38 minutes ago","Size":"0B","State":"running","Status":"Up 38 minutes"}
{"Command":"\"/docker-entrypoint.…\"","CreatedAt":"2025-05-13 09:58:01 +0000 UTC","ID":"c93b808dd54e","Image":"nginx:alpine","Labels":"desktop.docker.io/ports.scheme=v2,maintainer=NGINX Docker Maintainers \u003cdocker-maint@nginx.com \u003e","LocalVolumes":"0","Mounts":"","Names":"mycontainer","Networks":"bridge","Platform":{"architecture":"arm64","os":"linux","variant":"v8"},"Ports":"80/tcp","RunningFor":"53 minutes ago","Size":"0B","State":"running","Status":"Up 53 minutes"}
{"Command":"\"/usr/bin/gotty --ti…\"","CreatedAt":"2025-05-13 07:31:18 +0000 UTC","ID":"cbb981b06e46","Image":"thajeztah/dockershell:latest","Labels":"desktop.docker.io/ports.scheme=v2,com.thajeztah.docker-shell=1","LocalVolumes":"0","Mounts":"","Names":"trusting_goldstine","Networks":"bridge","Platform":{"architecture":"arm64","os":"linux"},"Ports":"0.0.0.0:55000-\u003e8080/tcp","RunningFor":"3 hours ago","Size":"0B","State":"running","Status":"Up 3 hours"}
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-21 12:44:38 +02:00
Jonathan A. Sternberg
7aa6c79c0a
docker ps: add "Platform" as formatting option
...
docker ps --format 'table {{.ID}}\t{{.Image}}{{.Command}}\t{{.RunningFor}}\t{{.Status}}\t{{.Ports}}\t{{.Names}}\t{{.Platform}}'
CONTAINER ID IMAGECOMMAND CREATED STATUS PORTS NAMES PLATFORM
e422855eac55 docker-cli-dev"/bin/bash" 12 minutes ago Up 12 minutes strange_jennings linux/arm64
Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com >
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-21 12:43:01 +02:00
Sebastiaan van Stijn
ed5d9757c9
vendor: github.com/docker/docker 8601b22f5db5 (v28.2-dev)
...
full diff: https://github.com/docker/docker/compare/v28.2.0-rc.1...8601b22f5db511354d643a7722d11d33aa7ae13f
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-19 22:47:14 +02:00
Sebastiaan van Stijn
c1313a92a0
golangci-lint: enable makezero linter
...
cli/command/container/formatter_stats_test.go:339:11: append to slice `stats` with non-zero initialized length (makezero)
stats = append(stats, entry)
^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-19 20:14:12 +02:00
Sebastiaan van Stijn
18e911c958
cli/command/container: TestContainerStatsContextWriteTrunc: use subtests
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-19 20:14:12 +02:00
Sebastiaan van Stijn
d65f0c9bbf
golangci-lint: enable exhaustive linter
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-19 20:14:04 +02:00
Sebastiaan van Stijn
062ad57ce2
golangci-lint: enable mirror linter
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-19 20:07:05 +02:00
Sebastiaan van Stijn
4665398a06
vendor: github.com/docker/docker 7937f0846c13 (master, v28.x dev)
...
full diff: https://github.com/docker/docker/compare/4b9f0707a039...7937f0846c130e91836f5f640c41ce12d07da4c8
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-19 14:07:50 +02:00
Sebastiaan van Stijn
7b1f889074
cli/command: make WithInitializeClient a wrapper for WithAPIClient
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-16 23:31:53 +02:00
Sebastiaan van Stijn
0d82ff4ae1
cli/command: move WithInitializeClient to other options
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-16 23:29:52 +02:00
Paweł Gronowski
8c8a81eaea
vendor: github.com/docker/docker v28.2.0-dev (4b9f0707a039)
...
full diff: https://github.com/docker/docker/compare/b45aa469cac7...4b9f0707a039
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com >
2025-05-16 21:12:49 +02:00
Sebastiaan van Stijn
1058b22800
cli/command: remove errdefs uses
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-16 20:30:00 +02:00
Sebastiaan van Stijn
eebf6824fc
cli/command/plugin: remove errdefs uses
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-16 20:30:00 +02:00
Sebastiaan van Stijn
214d2bfb6b
cli/command/image: remove errdefs uses
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-16 20:30:00 +02:00
Sebastiaan van Stijn
c4009463a7
cli/command/builder: remove errdefs uses
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-16 20:30:00 +02:00
Sebastiaan van Stijn
3d68a39015
cli/command/system: remove errdefs uses
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-16 20:30:00 +02:00
Sebastiaan van Stijn
251725676e
cli/command/trust: remove errdefs uses
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-16 20:29:50 +02:00
Sebastiaan van Stijn
1168edb259
cli/command/volume: use stdlib errors, remove errdefs uses
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-16 20:29:39 +02:00
Sebastiaan van Stijn
981e75e0f4
cli/command/network: use stdlib errors, remove errdefs uses
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-16 20:28:59 +02:00
Sebastiaan van Stijn
3382ee3e99
cli/command/context: use stdlib errors, remove errdefs uses
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-16 20:18:41 +02:00
Sebastiaan van Stijn
bfc6aeca4a
cli/command/container: define local errors instead of errdefs
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-16 20:18:40 +02:00
Paweł Gronowski
f6a077a831
system/info: Show discovered devices
...
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com >
2025-05-16 19:35:29 +02:00
Paweł Gronowski
be03dc9ce7
vendor: github.com/docker/docker v28.2.0-dev (b45aa469cac7)
...
full diff: https://github.com/docker/docker/compare/c04dec11437f...b45aa469cac7
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com >
2025-05-16 19:35:27 +02:00
Sebastiaan van Stijn
628b2f1a81
Merge pull request #6074 from thaJeztah/c8d_errdefs_is
...
switch to github.com/containerd/errdefs for error-matching
2025-05-16 18:11:26 +02:00
Sebastiaan van Stijn
7e609d491b
vendor: github.com/docker/docker c04dec11437f (master, v28.x dev)
...
full diff: https://github.com/docker/docker/compare/fd1a78e0a388c92d1a61b6bb159d5cba37c53349...c04dec11437ff0c3f0238892c554c882dabb6235
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-16 17:01:28 +02:00
Sebastiaan van Stijn
557cabb71e
switch to github.com/containerd/errdefs for error-matching
...
replace uses of docker/errdefs.IsXXX utilities with their containerd/errdefs
equivalent.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-16 15:27:43 +02:00
Sebastiaan van Stijn
c108da5d19
Merge pull request #6070 from thaJeztah/enable_importas_linter
...
golangci-lint: enable importas linter
2025-05-16 15:07:31 +02:00
Sebastiaan van Stijn
5ee17eefe6
cli/command/formatter: fix .Labels format being randomized
...
The labels are stored as a map, causing the output to be randomized.
This patch sorts the result to get a consistent output.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-16 14:11:56 +02:00
Sebastiaan van Stijn
e6bf6dcd90
cli/command/formatter: minor cleanups
...
no need to initialize with an empty string
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-16 14:10:34 +02:00
Sebastiaan van Stijn
43e496b396
cli/command/inspect: minor cleanup and improvements
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-16 14:10:31 +02:00
Sebastiaan van Stijn
7eaae97e37
cli/command/container: use consistent alias for oci-spec
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-16 12:34:28 +02:00
Sebastiaan van Stijn
77fbbc38de
Merge pull request #6063 from giautm/patch-1
...
cli/cli: use `len()` to check frontend ports in the `port` command
2025-05-16 12:03:15 +02:00
Sebastiaan van Stijn
bca09c7ac4
Merge pull request #6019 from thaJeztah/docker_auth_config_socket
...
cli/command/container: --use-api-socket: support DOCKER_AUTH_CONFIG
2025-05-16 11:57:49 +02:00
Sebastiaan van Stijn
267b5e7982
Merge pull request #6069 from thaJeztah/fluentd_completion
...
completion: add completion for "fluentd-write-timeout"
2025-05-16 11:46:34 +02:00
Sebastiaan van Stijn
535ac074d0
completion: add completion for "fluentd-write-timeout"
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-16 01:27:49 +02:00
Sebastiaan van Stijn
218c7ad958
cli/command/formatter: use ContainerState consts
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-16 01:13:14 +02:00
Sebastiaan van Stijn
6fd9c57744
cli/command/container: use ContainerState consts
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-16 01:13:14 +02:00
Sebastiaan van Stijn
21e96eaaa7
cli/command/completion: use ContainerState consts in tests
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-16 01:13:14 +02:00