1
0
mirror of https://github.com/docker/cli.git synced 2026-01-13 18:22:35 +03:00
Commit Graph

11825 Commits

Author SHA1 Message Date
Sebastiaan van Stijn
531f7e121d cli/command/completion: change Platforms to return a cobra.CompletionFunc
It's adding a slight indirection by constructing a function when called,
but makes the completion functions more consistent, the signature easier
to read, and making the return type a [cobra.CompletionFunc] makes it
more transparent what it's intended for, and helps discovery of functions
that provide completion.

[cobra.CompletionFunc]: https://pkg.go.dev/github.com/spf13/cobra#CompletionFunc

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-10 12:06:42 +02:00
Sebastiaan van Stijn
810be9fbe9 cli/command/completion: change Platforms to return a cobra.CompletionFunc
It's adding a slight indirection by constructing a function when called,
but makes the completion functions more consistent, the signature easier
to read, and making the return type a [cobra.CompletionFunc] makes it
more transparent what it's intended for, and helps discovery of functions
that provide completion.

[cobra.CompletionFunc]: https://pkg.go.dev/github.com/spf13/cobra#CompletionFunc

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-10 12:06:42 +02:00
Sebastiaan van Stijn
d18af47d0f cli/command/completion: change EnvVarNames to return a cobra.CompletionFunc
It's adding a slight indirection by constructing a function when called,
but makes the completion functions more consistent, the signature easier
to read, and making the return type a [cobra.CompletionFunc] makes it
more transparent what it's intended for, and helps discovery of functions
that provide completion.

[cobra.CompletionFunc]: https://pkg.go.dev/github.com/spf13/cobra#CompletionFunc

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-10 12:06:39 +02:00
Sebastiaan van Stijn
c5467b5556 Merge pull request #6246 from mmorel-35/revive/use-errors-new
ci: enable use-errors-new from revive
2025-09-10 11:38:14 +02:00
Sebastiaan van Stijn
8b23c2bcb5 Merge pull request #6444 from thaJeztah/inspect_completion
cli/command/system: add shell completion for "docker inspect"
2025-09-10 11:36:23 +02:00
Matthieu MOREL
22dda0fc2b ci: enable use-errors-new from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-09-10 11:31:26 +02:00
Sebastiaan van Stijn
69972b682b Merge pull request #6441 from thaJeztah/stderrs
cli/command: replace remaining uses of pkg/errors for stdlib
2025-09-10 10:20:21 +02:00
Sebastiaan van Stijn
8bb5595f28 cli/command/system: add shell completion for "docker inspect"
The "docker inspect" command can inspect any type of object, which would
require all possible endpoints to be contacted. By default, we don't
provide completion, but if a `--type` is passed, we provide completion
for the given type.

For example, `docker inspect --type container` will complete container
names, `docker inspect --type volume` will complete volume names and
so on.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-10 00:28:08 +02:00
Sebastiaan van Stijn
5245e20866 update vendor
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-09 19:58:08 +02:00
Sebastiaan van Stijn
c0e37dda14 cli/command/container: use stdlib errors
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-09 19:58:08 +02:00
Sebastiaan van Stijn
b774e75931 cli/command/system: use stdlib errors
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-09 19:58:07 +02:00
Sebastiaan van Stijn
9ba1314d3a cli/command/system: fix error formatting (errlint)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-09 19:58:07 +02:00
Sebastiaan van Stijn
c5150177bf cli/command/secret: use stdlib errors
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-09 19:58:07 +02:00
Sebastiaan van Stijn
573e0bddef cli/command/service: use stdlib errors
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-09 19:58:07 +02:00
Sebastiaan van Stijn
b057ab6d98 cli/command/stack: use stdlib errors
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-09 19:58:07 +02:00
Sebastiaan van Stijn
0e4934d36c cli/command/swarm: use stdlib errors
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-09 19:58:06 +02:00
Sebastiaan van Stijn
cd583313ee cli/command/plugin: use stdlib errors
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-09 19:58:06 +02:00
Sebastiaan van Stijn
5c8817b1b2 cli/command/node: use stdlib errors
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-09 19:58:06 +02:00
Sebastiaan van Stijn
bf78331f0c cli/command/container: runUpdate: use struct-literal
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-09 19:58:06 +02:00
Sebastiaan van Stijn
0c3bb6c0a4 cli/command/container: rename: remove renameOptions
Also remove redundant validation that's already performed by the client
or daemon.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-09 19:57:42 +02:00
Sebastiaan van Stijn
179dc0228c cli/command/image: use stdlib errors
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-09 17:23:58 +02:00
Sebastiaan van Stijn
f10041c724 Merge pull request #6439 from thaJeztah/plugin_rm_special_handling
cli/command/plugin: remove special error handling on install, upgrade
2025-09-09 11:59:51 +02:00
Sebastiaan van Stijn
62d25205e9 Merge pull request #6440 from thaJeztah/use_multierror
use native errors.Join for multi-errors on "docker ps", "docker node ls"
2025-09-09 10:47:23 +02:00
Sebastiaan van Stijn
fb3f2da50e cli/command/plugin: remove special error handling on install, upgrade
Similar to 323fbc485e - this code was added
in [moby@c127d96], but used string-matching to detect cases where a user
tried to install an image as plugin. However, this handling no longer matched
any error-strings, so no longer worked:

    docker plugin install busybox
    Error response from daemon: did not find plugin config for specified reference docker.io/library/busybox:latest

[moby@c127d96]: c127d9614f

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-08 20:37:03 +02:00
Sebastiaan van Stijn
5df02441ca cli/command/containers: runUpdate: use native errors.Join
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-08 20:30:41 +02:00
Sebastiaan van Stijn
935df8a78f cli/command/node: runPs: use native errors.Join
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-08 20:30:41 +02:00
Sebastiaan van Stijn
183337db9a Merge pull request #6438 from thaJeztah/internalize_loader
cli/command/stack: internalize GetConfigDetails, LoadComposefile, RunDeploy, RunRemove
2025-09-08 17:31:28 +02:00
Sebastiaan van Stijn
d62d370c23 Merge pull request #6435 from thaJeztah/templates_extract_formatJSON
templates: add formatJSON func
2025-09-08 17:30:37 +02:00
Sebastiaan van Stijn
26bb688ed0 cli/command/stack: internalize RunDeploy, RunRemove
These were deprecated in ad6ab189a6 and
were only used internally. Move them back inside the stack package.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-08 16:03:38 +02:00
Sebastiaan van Stijn
73677146f4 cli/command/stack: internalize GetConfigDetails, LoadComposefile
These were deprecated in ad6ab189a6 and
were only used internally. Move them back inside the stack package.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-08 15:24:35 +02:00
Sebastiaan van Stijn
c24b62f19c templates: add formatJSON func
Move the function used to format as JSON to a separate function instead
of definining it inline.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-08 12:06:46 +02:00
Sebastiaan van Stijn
be97096566 Merge pull request #6434 from thaJeztah/update_authors
update mailmap and authors
2025-09-06 00:18:07 +02:00
Sebastiaan van Stijn
c4a87de3ec update mailmap and authors
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-06 00:06:56 +02:00
Paweł Gronowski
4df42ef1d9 Merge pull request #6395 from thaJeztah/bump_engine
vendor: github.com/moby/moby/api v1.52.0-beta.1, client v0.1.0-beta.0
2025-09-05 23:39:16 +02:00
Sebastiaan van Stijn
b55fed5ef6 vendor: github.com/moby/moby/api v1.52.0-beta.1, client v0.1.0-beta.0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Co-authored-by: Austin Vazquez <austin.vazquez@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-05 22:41:03 +02:00
Paweł Gronowski
9fb049c8b6 Merge pull request #6433 from thaJeztah/bump_cdi
vendor: tags.cncf.io/container-device-interface v1.0.1
2025-09-05 22:27:10 +02:00
Sebastiaan van Stijn
35f5a4313b vendor: tags.cncf.io/container-device-interface v1.0.1
full diff: https://github.com/cncf-tags/container-device-interface/compare/v0.8.1...v1.0.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-05 21:47:23 +02:00
Austin Vazquez
589f56c345 Merge pull request #6432 from thaJeztah/rm_windows_warning
cli/command/image: build: remove permissions warning on Windows
2025-09-05 09:51:00 -07:00
Sebastiaan van Stijn
fa5b741c9b Merge pull request #6430 from austinvazquez/update-build-cache-prune-options
Set `ReservedSpace` field in preparation of `KeepStorage` deprecation
2025-09-05 16:28:53 +02:00
Sebastiaan van Stijn
af65ee4584 cli/command/image: build: remove permissions warning on Windows
This warning was added in [moby@4a8b3ca] to print a warning when building
Linux images from a Windows client. Window's filesystem does not have an
"executable" bit, which mean that, for example, copying a shell script
to an image during build would lose the executable bit. So for Windows
clients, the executable bit would be set on all files, unconditionally.

Originally this was detected in the client, which had direct access to
the API response headers, but when refactoring the client to use a common
library in [moby@535c4c9], this was refactored into a `ImageBuildResponse`
wrapper, deconstructing the API response into an `io.Reader` and a string
field containing only the `OSType` header.

This was the only use and only purpose of the `OSType` field, and now that
BuildKit is the default builder for Linux images, this warning didn't get
printed unless BuildKit was explicitly disabled.

This patch removes the warning, so that we can potentially remove the
field, or the `ImageBuildResponse` type altogether.

[moby@4a8b3ca]: 4a8b3cad60
[moby@535c4c9]: 535c4c9a59

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-05 13:35:07 +02:00
Austin Vazquez
7d85d8fbea Set ReservedSpace field in preparation of KeepStorage deprecation
This change updates the builder prune command to send the `ReservedSpace` parameter in preparation of `KeepStorage` deprecation in API v1.52.

Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-09-04 17:47:42 -05:00
Austin Vazquez
4ceef7d328 Merge pull request #6429 from thaJeztah/bump_cobra
vendor github.com/spf13/pflag v1.0.10, github.com/spf13/cobra v1.10.1
2025-09-04 15:46:36 -07:00
Austin Vazquez
3bbb633e5b Merge pull request #6427 from thaJeztah/avoid_client_types_in_opts
don't wrap client options
2025-09-04 15:45:00 -07:00
Sebastiaan van Stijn
fef8773bae vendor: github.com/spf13/cobra v1.10.1
full diff: https://github.com/spf13/cobra/compare/v1.9.1...v1.10.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-04 23:13:26 +02:00
Sebastiaan van Stijn
aba5962ffb vendor: github.com/spf13/pflag v1.0.10
full diff: https://github.com/spf13/pflag/compare/v1.0.6...v1.0.10

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-04 23:12:13 +02:00
Austin Vazquez
1f12d795db Merge pull request #6426 from docker/dependabot/github_actions/actions/setup-go-6
build(deps): bump actions/setup-go from 5 to 6
2025-09-04 12:27:51 -07:00
Sebastiaan van Stijn
e7d14d905e cli/command: don't wrap client options
We may still change this, but in the client module, the signature
of the client.Opt changed to now include a non-exported type, which
means that we can't construct a custom option that is implemented
using client options:

    #18 16.94 # github.com/docker/cli/cli/context/docker
    #18 16.94 cli/context/docker/load.go:105:29: cannot use withHTTPClient(tlsConfig) (value of type func(*client.Client) error) as client.Opt value in argument to append
    #18 16.94 cli/context/docker/load.go:152:6: cannot use c (variable of type *client.Client) as *client.clientConfig value in argument to client.WithHTTPClient(&http.Client{…})

We can consider exporting the `client.clientConfig` type (but keep its
fields non-exported), but for this use, we don't strictly need it, so
let's change the implementation to not having to depend on that.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-04 18:57:07 +02:00
Sebastiaan van Stijn
b0b0e457f0 cli/context/docker: don't wrap client options
We may still change this, but in the client module, the signature
of the client.Opt changed to now include a non-exported type, which
means that we can't construct a custom option that is implemented
using client options:

    #18 16.94 # github.com/docker/cli/cli/context/docker
    #18 16.94 cli/context/docker/load.go:105:29: cannot use withHTTPClient(tlsConfig) (value of type func(*client.Client) error) as client.Opt value in argument to append
    #18 16.94 cli/context/docker/load.go:152:6: cannot use c (variable of type *client.Client) as *client.clientConfig value in argument to client.WithHTTPClient(&http.Client{…})

We can consider exporting the `client.clientConfig` type (but keep its
fields non-exported), but for this use, we don't strictly need it, so
let's change the implementation to not having to depend on that.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-04 18:53:06 +02:00
dependabot[bot]
44e66a97a9 build(deps): bump actions/setup-go from 5 to 6
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5 to 6.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-04 11:32:37 +00:00
Paweł Gronowski
27b316fc0d Merge pull request #6421 from vvoland/update-go
update to go1.24.7
2025-09-03 21:28:52 +02:00