Commit Graph

11889 Commits

Author SHA1 Message Date
ef3c19a80b Merge pull request #6494 from thaJeztah/deprecate_ContentTrustEnabled
cli/command: deprecate DockerCli.ContentTrustEnabled
2025-09-25 11:24:05 +00:00
11d40488dd cli/command: deprecate DockerCli.ContentTrustEnabled
This function was used internally, but is no longer used. Users should check
the value of the `DOCKER_CONTENT_TRUST` environment variable instead.

There are no known external users of this method, so already removing it
from the Cli interface; this method will be removed in the next release.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-25 12:45:13 +02:00
1bae6aafa8 trust: add internal utility for checking DOCKER_CONTENT_TRUST
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-25 12:45:08 +02:00
1ace9aec34 cli/command: don't use DCT status for trust stub-flags
This is a follow-up to 7609dde8d0 and
3f5b1bdd32, which removed support for
DCT for build and plugin commands.

As these flags are just stubs, hidden by default and no longer functional,
they don't have to reflect the current state of DCT.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-25 12:39:28 +02:00
734328eef9 Merge pull request #6492 from thaJeztah/fix_alpine
e2e: update openssh, openssl to work around openssh bug
2025-09-25 11:39:52 +02:00
9c88b315ef Merge pull request #6488 from thaJeztah/deprecate_dct_opts
cli/command: deprecate WithContentTrustFromEnv, WithContentTrust
2025-09-25 11:31:55 +02:00
04bfe7dc78 Merge pull request #6490 from thaJeztah/deprecate_defaultversion
cli/command: deprecate DockerCli.DefaultVersion
2025-09-25 11:31:27 +02:00
b611f288ee e2e: update openssh, openssl to work around openssh bug
relates to https://gitlab.alpinelinux.org/alpine/aports/-/issues/17547

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-25 10:57:14 +02:00
40cdfc0d81 cli/command: deprecate WithContentTrustFromEnv, WithContentTrust
These options were used internally as defaults for the constructor and
only impact commands implemented in the CLI itself.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-25 09:57:28 +02:00
0270b2d6f7 cli/command: deprecate DockerCli.DefaultVersion
This function was used internally, but is no longer used. There are
no known users of this method, so already removing it from the Cli
interface.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-25 09:38:46 +02:00
903e9b3426 Merge pull request #6453 from thaJeztah/rm_deprecated_template
templates: remove deprecated NewParse function
2025-09-24 10:40:45 -07:00
a44144e1db Merge pull request #6479 from thaJeztah/plugin_semverish
cli-plugins/manager: allow schema-versions <= 2.0.0
2025-09-24 19:25:43 +02:00
ed7908e4ed Merge pull request #4574 from milas/cli-user-agent
cli/command: add WithUserAgent option
2025-09-24 19:16:38 +02:00
048e931b42 cli/command: add WithUserAgent option
Add support to the `cli/command` package to accept a custom User
Agent to pass to the underlying client.

This is used as the `UpstreamClient` portion of the `User-Agent`
when the Moby daemon makes requests.

For example, pushing and pulling images with Compose might result
in the registry seeing a `User-Agent` value of:

```
docker/24.0.7 go/go1.20.10 git-commit/311b9ff kernel/6.5.13-linuxkit os/linux arch/arm64 UpstreamClient(docker-cli-plugin-compose/v2.24.0)
```

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-24 17:43:41 +02:00
ec912e5524 cli-plugins/manager: allow schema-versions <= 2.0.0
The CLI currently hard-codes the schema-version for CLI plugins to
"0.1.0", which doesn't allow us to expand the schema for plugins.

As there's many plugins that we shipped already, we can't break
compatibility until we reach 2.0.0, but we can expand the schema
with non-breaking changes.

This patch makes the validation more permissive to allow new schema
versions <= 2.0.0. Note that existing CLIs will still invalidate
such versions, so we cannot update the version until such CLIs are
no longer expected to be used, but this patch lays the ground-work
to open that option.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-24 16:17:33 +02:00
8fbb70ae56 Merge pull request #6475 from thaJeztah/cli_plugin_options
cli-plugins/plugin: Run: allow customizing the CLI
2025-09-24 07:15:24 -07:00
f3687d8a8b Merge pull request #5922 from thaJeztah/ignore_broken_symlinks
cli-plugins/manager: ignore broken symlinks
2025-09-24 15:10:23 +02:00
9b2f831452 cli-plugins/manager: ignore broken symlinks
Before this patch, a broken symlink would print a warning;

    docker info > /dev/null
    WARNING: Plugin "/Users/thajeztah/.docker/cli-plugins/docker-feedback" is not valid: failed to fetch metadata: fork/exec /Users/thajeztah/.docker/cli-plugins/docker-feedback: no such file or directory

After this patch, such symlinks are ignored:

    docker info > /dev/null

With debug enabled, we don't ignore the faulty plugin, which will
make the warning shown on docker info;

    mkdir -p ~/.docker/cli-plugins
    ln -s nosuchplugin ~/.docker/cli-plugins/docker-brokenplugin
    docker --debug info
    Client:
     Version:    29.0.0-dev
     Context:    default
     Debug Mode: true
     Plugins:
      buildx: Docker Buildx (Docker Inc.)
        Version:  v0.25.0
        Path:     /usr/libexec/docker/cli-plugins/docker-buildx
    WARNING: Plugin "/Users/thajeztah/.docker/cli-plugins/docker-brokenplugin" is not valid: failed to fetch metadata: fork/exec /Users/thajeztah/.docker/cli-plugins/docker-brokenplugin: no such file or directory

    # ...

We should als consider passing a "seen" map to de-duplicate entries.
Entries can be either a direct symlink or in a symlinked path (for
which we can filepath.EvalSymlinks). We need to benchmark the overhead
of resolving the symlink vs possibly calling the plugin (to get their
metadata) further down the line.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-24 14:32:37 +02:00
2711800430 cli-plugins/plugin: Run: allow customizing the CLI
Currently, the plugin.Run command constructs the DockerCli using
the default options, assuming plugins run with all the same options
as the CLI itself; to customize the CLI there's a "Apply" option,
but this means mutating the CLI after it's already constructed, which
is not ideal.

This patch adds a variadic ops argument to allow CLI plugins to pass
custom options to use for the CLI, so that there's no need to mutate
its config in most cases.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-24 14:17:15 +02:00
84520653d8 templates: remove deprecated NewParse function
This was deprecated in 7ab3e7e774 and
no longer used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-24 14:08:27 +02:00
c8600e1cea Merge pull request #6463 from thaJeztah/remove_oauth_escape_hatch
remove DOCKER_CLI_DISABLE_OAUTH_LOGIN escape hatch
2025-09-24 13:43:42 +02:00
4a4043cdb6 Merge pull request #6462 from thaJeztah/rm_deprecated_registryclient
remove deprecated cli/registry/client package
2025-09-24 13:18:58 +02:00
7cc801d93d Merge pull request #6467 from thaJeztah/no_apply
cli/command: NewDockerCli: don't depend on DockerCli.Apply
2025-09-24 13:17:51 +02:00
7afda4c6c5 Merge pull request #6468 from thaJeztah/cli_plugins_touchup
cli-plugins/plugin: Run: touch-up godoc and minor cleanups
2025-09-24 13:17:38 +02:00
550d40f7bc Merge pull request #6466 from thaJeztah/registry_3
e2e: use registry v3
2025-09-24 13:17:23 +02:00
5710de6d9a Merge pull request #6461 from thaJeztah/bump_xx
Dockerfile: update xx to v1.7.0
2025-09-24 13:17:13 +02:00
93bb8a7a0a Merge pull request #6458 from thaJeztah/bump_engine
vendor: github.com/moby/moby/api, github.com/moby/moby/client master
2025-09-24 13:16:39 +02:00
b1d45285ba Merge pull request #6464 from thaJeztah/remove_deprecated_experimental
cli/config/configfile: remove deprecated ConfigFile.Experimental field
2025-09-24 13:15:54 +02:00
4c802a1548 Merge pull request #6465 from thaJeztah/rm_23_test
gha: update test-matrix: remove docker 23.x, 26.x, add 25.x
2025-09-24 13:15:27 +02:00
635a718209 cli-plugins/plugin: Run: touch-up godoc and minor cleanups
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-24 12:57:42 +02:00
133279fb0d cli/command: NewDockerCli: don't depend on DockerCli.Apply
The Apply method was added when CLI options for constructing the CLI were
rewritten into functional options in [cli@7f207f3]. There was no mention
in the pull request of this method specifically, and this may have been
related to work being done elsewhere on compose-on-kubernetes or the
compose-cli plugin that may have needed options to modify the CLI config
after it was already initialized.

We should try to remove functions that mutate the CLI configuration after
initialization if possible (and likely remove the `Apply` method); currently
this function is used in docker compose, but as part of a hack that can
probably be avoided.

[cli@7f207f3]: 7f207f3f95

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-24 12:10:57 +02:00
daa15c3bfa e2e: use registry v3
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-24 10:28:42 +02:00
83e40c39b4 gha: update test-matrix: remove docker 23.x, 26.x, add 25.x
- Mirantis Container Runtime (MCR) 23.0 reached EOL, and the next LTS
  version of MCR is 25.x
- Docker 26.x reached EOL and is no longer maintained

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-24 10:12:05 +02:00
71f46056c9 remove DOCKER_CLI_DISABLE_OAUTH_LOGIN escape hatch
This code was added in 846ecf59ff as an
escape hatch in case the new OAuth login flow would cause problems.
We have not received reports where the new flow caused problems, and
searching the internet shows no mentions of the env-var.

This env-var was not documented, so we can remove it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-23 21:47:30 +02:00
a53e83a3d4 cli/config/configfile: remove deprecated ConfigFile.Experimental field
Configuration options for experimental CLI features were deprecated in
docker 19.03 (3172219932), and enabled by
default since docker 20.10 (977d3ae046).

This field was deprecated in c8f9187157,
which is part of the 28.x release, and is unused. This patch removes
the field.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-23 21:43:14 +02:00
083e5ce872 cli/command/registry: remove deprecated OauthLoginEscapeHatchEnvVar
This const was added in 846ecf59ff, but
only used internally; commit 18cdc25bb4
deprecated the const, which was included in the 28.4 release.

This patch removes the exported const, as it's unused.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-23 21:31:43 +02:00
3cf005ec91 remove deprecated cli/registry/client package
This package was deprecated in 13010ba673,
and only used internally. The deprecation was included in the 28.4 release,
and there's no known external users, so we can remove it for v29.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-23 21:21:31 +02:00
c5cbb3e648 vendor: github.com/moby/moby/api, github.com/moby/moby/client master
full diffs:

- https://github.com/moby/moby/compare/api/v1.52.0-beta.1...e98849831fc4e35bdc09ed31b85f91caa87a0103
- https://github.com/moby/moby/compare/client/v0.1.0-beta.0...e98849831fc4e35bdc09ed31b85f91caa87a0103

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-23 21:11:17 +02:00
e241f53ebc Merge pull request #6460 from thaJeztah/no_pause
deprecate "--pause" flag on docker commit in favor of "--no-pause"
2025-09-23 12:54:15 +02:00
0f08b55bce Dockerfile: update xx to v1.7.0
full diff: https://github.com/tonistiigi/xx/compare/v1.6.1...v1.7.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-23 10:42:15 +02:00
3c244d1099 deprecate "--pause" flag on docker commit in favor of "--no-pause"
Commit [moby@17d870b] (API v1.13, docker v1.1.0) changed the default to pause
containers during commit, keeping the behavior opt-in for older API versions.
This version-gate was removed in [moby@1b1147e] because API versions lower
than v1.23 were no longer supported.

This patch deprecates the `--pause` flag in favor of a `--no-pause` flag to
be more explicit on the default. The old `--pause` flag is marked deprecated
but still functional. Using the deprecated flag will print a warning, and an
error is produced when trying to use both the old and new flag;

    docker commit --pause mycontainer
    Flag --pause has been deprecated, and enabled by default. Use --no-pause to disable pausing during commit.

    docker commit --pause=false mycontainer
    Flag --pause has been deprecated, and enabled by default. Use --no-pause to disable pausing during commit.

    docker commit --pause --no-pause mycontainer
    Flag --pause has been deprecated, use --no-pause instead
    conflicting options: --no-pause and --pause cannot be used together

[moby@17d870b]: 17d870bed5
[moby@1b1147e]: 1b1147e46b

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-22 15:41:22 +02:00
233322637a Merge pull request #6452 from doringeman/image-list-completions
Enable completion for `docker images`
2025-09-19 10:57:16 +02:00
5d8fb335d4 Merge pull request #6455 from thaJeztah/rm_kmem
cli/command/container: fully deprecate --kernel-memory options
2025-09-16 19:40:56 +02:00
f4a433f841 cli/command/container: fully deprecate --kernel-memory options
The `--kernel-memory` flag was still included to allow it to be used with
old API versions, but it's no longer supported by the kernel, and no longer
handled by OCI runtimes, so deprecating the flags.

With this patch, a deprecation warning is now produced when trying to use
the option;

    docker run --kernel-memory 123b busybox
    Flag --kernel-memory has been deprecated, this option is deprecated in the kernel and no longer supported

    docker container create --kernel-memory 123b busybox
    Flag --kernel-memory has been deprecated, and no longer supported by the kernel
    31fb57e2c6434490a2892031602be20d0206d3cf0fc281ea25654c46dcb62bac

Note that cobra does not _fail_ the command when using deprecated options;
we could make this a hard failure instead, but may not be worth the effort.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-16 15:36:45 +02:00
a02902eb78 docs: deprecated: complete deprecation of kernel-memory limit
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-16 13:50:16 +02:00
437f1260fd Enable completion for docker images
Signed-off-by: Dorin Geman <dorin.geman@docker.com>
2025-09-15 11:30:40 +03:00
4373ce5f8b Merge pull request #6451 from thaJeztah/fix_stats_bounds
cli/command/container: prevent panic during stats on empty event Actor.ID
2025-09-11 17:27:50 +02:00
9b79e48646 cli/command/container: prevent panic during stats on empty event Actor.ID
This code was missing a check for the ID field before truncating it to a
shorter length for presentation. This would result in a panic if an event
would either have an empty ID field or a shorter length ID;

    panic: runtime error: slice bounds out of range [:12] with length 0

    goroutine 82 [running]:
    github.com/docker/cli/cli/command/container.RunStats.func2({{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0x40001fcba0, 0x9}, {0x40001fcba9, 0x5}, ...})
        /go/src/github.com/docker/cli/cli/command/container/stats.go:146 +0x1d0
    created by github.com/docker/cli/cli/command/container.(*eventHandler).watch in goroutine 6
        /go/src/github.com/docker/cli/cli/command/container/stats.go:363 +0x1c8

We need to look at this code in general; the truncated ID is passed to
NewStats, which uses the ID to propagate the `Container` field in the
`StatsEntry` struct. which is not used in the default format used by
`docker stats` and, having the same content as the `ID` field on the
same struct, doesn't make it very useful, other than being able to
present it under a `CONTAINER` column (instead of `CONTAINER ID`);
we should consider deprecating it; there may be some subtle things
to look into here; the `Container` field originally held the container
name. This was changed in [moby@ef915fd], which introduced separate
`ID` and `Name` fields, renaming the old `Name` field to container.

Looking at [`Stats.SetStatistics()`] and related code in [stats_helpers.go],
the `Container` field is used as the "canonical" reference for the stats
record; this allows the stats _data_ to be refreshed when a new stats
sample arrives for the same container (also see [moby@929a77b], which
moved locking to the `Stats` wrapper struct). This construct allows to
account for intermediate states, where a stats sample was incomplete
or could produce an error; in that case, the reference to the container
for which the stats were sampled is kept to allow removing a container
from the list once the container was removed. We should consider removing
`Container` as a formatting option, and moving the `Container` field to
the outer struct; this makes the outer struct responsible for keeping a
reference to the container, allowing the `StatsEntry` as a whole to be
replaced atomically.

This patch only addresses the panic;

- It changes the logic to preserve the container ID verbatim instead
  of truncating. This allows stats samples to be matched against the
  `Actor.ID` as-is.
- Truncating the `Container` is moved to the presentation logic;
  currently this does not take `--no-trunc` into account to keep
  the existing behavior, but we can (should) consider adding this.
- Logging is improved to use structured logs, and an extra check is
  added to prevent empty IDs from being added as watcher.

[`Stats.SetStatistics()`]: 82281087e3/cli/command/container/formatter_stats.go (L88-L94)
[moby@ef915fd]: ef915fd036
[moby@929a77b]: 929a77b814
[stats_helpers.go]: 82281087e3/cli/command/container/stats_helpers.go (L26-L51)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-11 14:28:25 +02:00
b9314938b7 cli/command/container: improve TestContainerStatsContext
- Use sub-tests
- Don't use un-named keys
- Add test-cases for 'Name', 'ID' and custom container names

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-11 14:10:54 +02:00
b8cda96d11 cli/command/container: improve TestContainerStatsContext
- Don't use unnamed keys
- Use sub-tests
- Add test-cases for Name and ID fields

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-11 13:58:50 +02:00