Alano Terblanche
9b83d5bbf9
Use DOCKER_AUTH_CONFIG env as credential store
...
This patch enables the CLI to natively pick up the `DOCKER_AUTH_CONFIG`
environment variable and use it as a credential store.
The `DOCKER_AUTH_CONFIG` value should be a JSON object and must store
the credentials in a base64 encoded string under the `auth` key.
Specifying additional fields will cause the parser to fail.
For example:
`printf "username:pat" | openssl base64 -A`
`export DOCKER_AUTH_CONFIG='{
"auths": {
"https://index.docker.io/v1/ ": {
"auth": "aGk6KTpkY2tyX3BhdF9oZWxsbw=="
}
}
}'`
Credentials stored in `DOCKER_AUTH_CONFIG` would take precedence over any
credential stored in the file store (`~/.docker/config.json`) or native store
(credential helper).
Destructive actions, such as deleting a credential would result in a noop if
found in the environment credential. Credentials found in the file or
native store would get removed.
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com >
2025-06-18 18:55:42 +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
Cesar Talledo
8993f54fc3
Add support for multiple platforms in docker image save
...
Signed-off-by: Cesar Talledo <cesar.talledo@docker.com >
2025-06-10 16:34:07 -07:00
Cesar Talledo
38b99adc10
Add support for multiple platforms in docker image load.
...
Signed-off-by: Cesar Talledo <cesar.talledo@docker.com >
2025-06-10 16:34:02 -07:00
Sebastiaan van Stijn
342f8bca25
builder: remove // import comments
...
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.
Remove these imports in preparation of migrating our code to become an
actual go module.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-30 15:59:11 +02:00
Sebastiaan van Stijn
2d21e1f7a5
cli/config/configfile: explicitly ignore error
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-28 09:55:33 +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
1015d15621
fix bug with config file being a relative symlink
...
- use filepath.EvalSymlink instead of check with filepath.IsAbs
- allow for dangling symlinks
- extract path from error when NotExist error occurs
Co-authored-by: Paweł Gronowski <me@woland.xyz >
Co-authored-by: Sebastiaan van Stijn <github@gone.nl >
Signed-off-by: Will Wang <willww64@gmail.com >
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-22 11:11:07 +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
b883976531
cli/context/store: use stdlib errors, remove errdefs uses
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-16 20:18:40 +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
d956110288
Merge pull request #1581 from thaJeztah/dont_use_tls_for_sockets
...
Don't use TLS for socket connections
2025-05-16 15:45:13 +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
378e754c88
use consistent alias for gotest.tools/v3/assert/cmp
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-05-16 12:36:14 +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