1
0
mirror of https://github.com/docker/cli.git synced 2025-11-25 18:03:19 +03:00
Commit Graph

1570 Commits

Author SHA1 Message Date
David Karlsson
3a842587f9 chore: update link/linktext to dockerd proxy config
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2025-11-17 11:00:04 +01:00
Paweł Gronowski
be9e6308f5 image/tree: Respect NO_COLOR env variable
Do not use the fancy colored output if NO_COLOR variable is set to 1
following the https://no-color.org/ convention.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-11-13 14:56:27 +01:00
Sebastiaan van Stijn
5b443bf269 Merge pull request #6619 from dperny/swarm-memory-swap
Add memory swap to swarm
2025-11-07 01:03:26 +01:00
Sebastiaan van Stijn
c9e6b41293 Merge pull request #6633 from dvdksn/docs-update-dd-documentation-link
chore: update broken link to restrucured docker desktop documentation
2025-11-07 00:34:43 +01:00
Drew Erny
71828f2792 Add memory swap to swarm
Adds support for setting memory swap settings on Swarm services

* Adds flags `memory-swap` and `memory-swappiness` to `docker service
create` and `docker service update` commands.
* Adds compose fields `memswap_limit` and `mem_swappiness` for `docker
stack` commands.

Signed-off-by: Drew Erny <derny@mirantis.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-07 00:24:44 +01:00
Sebastiaan van Stijn
c9bb291154 implement docker trust as plugin
move the `trust` subcommands to a plugin, so that the subcommands can
be installed separate from the `docker trust` integration in push/pull
(for situations where trust verification happens on the daemon side).

    make binary
    go build -o /usr/libexec/docker/cli-plugins/docker-trust ./cmd/docker-trust

    docker info
    Client:
     Version:    28.2.0-dev
     Context:    default
     Debug Mode: false
     Plugins:
      buildx: Docker Buildx (Docker Inc.)
        Version:  v0.24.0
        Path:     /usr/libexec/docker/cli-plugins/docker-buildx
      trust: Manage trust on Docker images (Docker Inc.)
        Version:  unknown-version
        Path:     /usr/libexec/docker/cli-plugins/docker-trust

    docker trust --help
    Usage:  docker trust [OPTIONS] COMMAND

    Extended build capabilities with BuildKit

    Options:
      -D, --debug   Enable debug logging

    Management Commands:
      key         Manage keys for signing Docker images
      signer      Manage entities who can sign Docker images

    Commands:
      inspect     Return low-level information about keys and signatures
      revoke      Remove trust for an image
      sign        Sign an image

    Run 'docker trust COMMAND --help' for more information on a command.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-06 15:24:46 +01:00
David Karlsson
dd70b43bc1 chore: update broken link to restrucured docker desktop documentation
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2025-11-06 14:40:16 +01:00
Sebastiaan van Stijn
ad776d1e10 remove support for client-side docker content trust validation
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-03 14:21:19 +01:00
Sebastiaan van Stijn
e6d150be16 opts: FilterOpt: show empty string if no values are set
follow-up to f81816ef88

We could decide to not initialize a default, and do this only when
setting a value, but this may require more changes, so doing this
as a starting-point.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-13 12:09:26 +02:00
Sebastiaan van Stijn
5ad91456c7 docs: update some versions in examples
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-10 21:23:30 +02:00
Sebastiaan van Stijn
f81816ef88 vendor: github.com/moby/moby/api, client 0769fe708773 (master)
full diff: 4ca8aedf92...0769fe7087

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-10 19:35:00 +02:00
Sebastiaan van Stijn
c361deb85d docs, man: image ls: remove VirtualSize from examples
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-30 16:26:06 +02:00
Sebastiaan van Stijn
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
Sebastiaan van Stijn
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
Sebastiaan van Stijn
f14eeeb361 cli/flags: add "hostVar" to handle --host / -H as a single string
hostVar is used for the '--host' / '-H' flag to set [ClientOptions.Hosts].
The [ClientOptions.Hosts] field is a slice because it was originally shared
with the daemon config. However, the CLI only allows for a single host to
be specified.

hostVar presents itself as a "string", but stores the value in a string
slice. It produces an error when trying to set multiple values, matching
the check in [getServerHost].

[getServerHost]: 7eab668982/cli/command/cli.go (L542-L551)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-18 11:01:39 +02:00
Sebastiaan van Stijn
5ee2906e78 cli/flags: use a regular StringArray for the --host / -H flag
The ClientOptions struct and related flags were inherited from the Moby
repository, where originally the CLI and Daemon used the same implementation
and had a "Common" options struct. When the CLI moved to a separate repository,
those structs were duplicated, but some daemon-specific logic remained. For
example, the daemon can be configured to listen on multiple ports and sockets
([moby@dede158]), but the CLI [can only connect to a single host][1]. The
daemon config also had to account for flags conflicting with `daemon.json`,
and use special flag-vars for this ([moby@677a6b3]).

Unfortunately, the `ClientConfig` struct became part of the public API and
is used as argument in various places, but we can remove the use of the
special flag var. This patch replaces the use of `NewNamedListOptsRef`
for a regular `StringArray`.

Unfortunately this changes the flag's type description from `list` to
`stringArray`, but we can look at changing that separately.

[moby@dede158]: dede1585ee
[1]: 0af135e906/docker/docker.go (L191-L193)
[moby@677a6b3]: 677a6b3506

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-16 19:13:27 +02:00
Sebastiaan van Stijn
bf13010df8 docs: fix output example for docker system prune
The example shows that the `--volumes` option is used, which in current
versions of docker only removes "anonymous" volumes, but preserves named
volume:

    $ docker system prune -a --volumes
    ...
            - all anonymous volumes not used by at least one container
    ...

But the example output showed that a named volume ("named-vol") was
deleted;

    Deleted Volumes:
    named-vol

Co-authored-by: Roberto Villarreal <rrjjvv@yahoo.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-15 12:55:03 +02:00
Sebastiaan van Stijn
3f5b1bdd32 cli/command/plugin: remove DCT
Plugins are not widely used, and there's no known plugins that use
content-trust. We're working on updating the authentication stack
in the CLI, and the trust implementation hinders us in making
changes, so removing parts that are not high-priority (ahead of
full deprecation of DCT).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-06 12:33:27 +02:00
Sebastiaan van Stijn
abfe4d4629 remove deprecated bind-nonrecursive option for --mount
The `bind-nonrecursive` option was replaced with the [`bind-recursive`]
option (see [cli-4316], [cli-4671]). The option was still accepted, but
printed a deprecation warning:

    bind-nonrecursive is deprecated, use bind-recursive=disabled instead

In the v29.0 release, this warning is removed, and returned as an error.
Users should use the equivalent `bind-recursive=disabled` option instead.

[`bind-recursive`]: https://docs.docker.com/engine/storage/bind-mounts/#recursive-mounts
[cli-4316]: https://github.com/docker/cli/pull/4316
[cli-4671]: https://github.com/docker/cli/pull/4671

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-05 23:23:38 +02:00
Paweł Gronowski
1ca6c946d5 Merge pull request #6126 from ctalledo/fix-for-moby-48759
Add support for multiple platform options in image load and save
2025-07-24 11:48:11 +02:00
Sebastiaan van Stijn
7609dde8d0 build: remove DCT support for classic builder
Docker Content Trust is currently only implemented for the classic
builder, but is known to not work with multi-stage builds, and
requires rewriting the Dockerfile, which is brittle because the
Dockerfile syntax evolved with the introduction of BuildKit as
default builder.

Given that the classic builder is deprecated, and only used for
Windows images, which are not verified by content trust;

    # docker pull --disable-content-trust=false mcr.microsoft.com/windows/servercore:ltsc2025
    Error: remote trust data does not exist for mcr.microsoft.com/windows/servercore: mcr.microsoft.com does not have trust data for mcr.microsoft.com/windows/servercore

With content trust not implemented in BuildKit, and not implemented
in docker compose, this resulted in an inconsistent behavior.

This patch removes content-trust support for "docker build". As this
is a client-side feature, users who require this feature can still
use an older CLI to to start the build.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 19:05:38 +02:00
Paweł Gronowski
8eac03d5fa docs: fix CDI device configuration anchor
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-07-11 10:44:29 +02:00
ArthurFlag
7e040d91ef docs: cdi is not experimental anymore
Signed-off-by: ArthurFlag <arthur.flageul@docker.com>
2025-07-07 16:10:30 +02:00
Cesar Talledo
0ba4362d69 Update markdown docs to indicate multi-platform support in image load/save.
Signed-off-by: Cesar Talledo <cesar.talledo@docker.com>
2025-06-10 16:42:39 -07: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
6f856263c2 Merge pull request #6053 from thaJeztah/import_docs
docs: import: assorted fixes and touch-ups
2025-05-08 12:53:29 +02:00
Sebastiaan van Stijn
a2a13765f7 Merge pull request #6052 from thaJeztah/inspect_completion
inspect: add shell completion, improve flag-description for `--type` and improve validation
2025-05-06 20:29:54 +02:00
Sebastiaan van Stijn
12c0c13c3b Merge pull request #6051 from thaJeztah/inspect_fix_flags
docs: move flag examples to right section
2025-05-06 20:29:27 +02:00
Sebastiaan van Stijn
4520a390d2 docs: import: add example for multiple --change flags
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-06 19:40:53 +02:00
Sebastiaan van Stijn
763ae3e0fb docs: import: update documentation for --platform
The `--platform` flag originally was added for the experimental LCOW
feature and only accepted the target operating system. Current versions
of Docker allow passing both OS and Architecture, so updating the
documentation to reflect this.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-06 19:40:53 +02:00
Sebastiaan van Stijn
2a67d601ad docs: import: update list of supported options for --change
Update the list of accepted "change" commands to match what's accepted
by the daemon. This list is the same for "docker commit" and "docker import",
which is defined by the [`validCommitCommands`] variable.

[`validCommitCommands`]: https://github.com/moby/moby/blob/v28.1.1/builder/dockerfile/builder.go#L30-L42

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-06 19:40:52 +02:00
Sebastiaan van Stijn
79207281fb docs: import: fix anchor-links and minor touch-up
- Put the content related to `--changes` under a heading with the correct
  anchor, so that it will be linked from the "options" table.
- Move note about `sudo` to be under the right example.
- Update  some examples to directly read from a file instead of piping.
- Add heading for the `--message` flag.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-06 19:40:47 +02:00
Sebastiaan van Stijn
8c5aaff57f inspect: update flag description of "--type" flag
Before this patch:

    docker inspect --help | grep '\-\-type'
          --type string     Return JSON for specified type

With this patch:

    docker inspect --help | grep '\-\-type'
          --type string     Only inspect objects of the given type

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-06 15:45:38 +02:00
Sebastiaan van Stijn
fc3ed90e3a docs: move flag examples to right section
When generating our docs, flag-descriptions are currently expected
to be under the "examples" section for them to be linked correctly.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-06 13:32:30 +02:00
林博仁 Buo-ren Lin
75d54ac613 run: Drop unnecessary command options of the --workdir example
The `-i` and `-t` options are not needed, as the `pwd` command does not require a TTY nor an interactive session.  Drop them to simplify the example and avoid causing unnecessary confusion to the reader.

Signed-off-by: 林博仁(Buo-ren Lin) <buo.ren.lin@gmail.com>
2025-05-06 18:53:42 +08:00
Sebastiaan van Stijn
3c4bcce81e docs: image import: fix heading to be included in online docs
The online docs looks for level-3 headings under the "examples"
to be included.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-23 09:57:08 +02:00
Stephen Day
1a502e91c9 run: flag to include the Docker API socket
Adds a flag to the create and run command, `--use-api-socket`, that can
be used to start a container with the correctly configured parameters to
ensure that accessing the docker socket will work with out managing bind
mounts and authentication injection.

The implementation in this PR resolves the tokens for the current
credential set in the client and then copies it into a container at the
well know location of /run/secrets/docker/config.json, setting
DOCKER_CONFIG to ensure it is resolved by existing tooling. We use a
compose-compatible secret location with the hope that the CLI and
compose can work together seamlessly.

The bind mount for the socket is resolved from the current context,
erroring out if the flag is set and the provided socket is not a unix
socket.

There are a few drawbacks to this approach but it resolves a long
standing pain point. We'll continue to develop this as we understand
more use cases but it is marked as experimental for now.

Signed-off-by: Stephen Day <stephen.day@docker.com>
2025-04-15 10:57:44 -07:00
Sebastiaan van Stijn
adb0abaec5 add top-level "docker bake" command as alias for "docker buildx bake"
The [`docker buildx bake`][1] command has reached GA; this patch adds
a top-level `docker bake` command as alias for `docker buildx bake` to
improve discoverability and make it more convenient to use.

With this patch:

    docker --help

    Usage:  docker [OPTIONS] COMMAND

    A self-sufficient runtime for containers

    Common Commands:
      run         Create and run a new container from an image
      exec        Execute a command in a running container
      ps          List containers
      build       Build an image from a Dockerfile
      bake        Build from a file
      pull        Download an image from a registry
      push        Upload an image to a registry
      images      List images
    ...

The command is hidden if buildx is not installed;

    docker --help
    Usage:  docker [OPTIONS] COMMAND

    A self-sufficient runtime for containers

    Common Commands:
      run         Create and run a new container from an image
      exec        Execute a command in a running container
      ps          List containers
      build       Build an image from a Dockerfile
      pull        Download an image from a registry
      push        Upload an image to a registry
      images      List images
    ...

We can do some tweaking after this; currently it show an error
in situations where buildx is missing. We don't account for
"DOCKER_BUILDKIT=0", because this is a new feature that requires
buildx, and cannot be "disabled";

buildx missing;

    docker bake
    ERROR: bake requires the buildx component but it is missing or broken.
           Install the buildx component to use bake:
           https://docs.docker.com/go/buildx/

BuildKit disabled:

    DOCKER_BUILDKIT=0 docker bake
    ERROR: bake requires the buildx component but it is missing or broken.
           Install the buildx component to use bake:
           https://docs.docker.com/go/buildx/

[1]: https://www.docker.com/blog/ga-launch-docker-bake/

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-11 16:28:47 +02:00
Paweł Gronowski
0d9d187f31 image/inspect: Add --platform flag
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-04-11 15:53:41 +02:00
Sebastiaan van Stijn
8b222aedfa docs/reference: search: remove mention of deprecated "IsAutomated"
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-31 17:45:20 +02:00
Sebastiaan van Stijn
068a01ea94 Merge pull request #5870 from thaJeztah/carry_5855
Add detailed descriptions for --ulimit options in docker run documentation
2025-02-25 18:52:55 +01:00
MHM0098
d75f8d83d3 Add detailed descriptions for --ulimit options in docker run documentation
Signed-off-by: MHM0098 <mhm98035@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-25 16:15:21 +01:00
Sebastiaan van Stijn
aad2ae50e8 docs: network ls add heading and anchor for "--no-trunc"
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-21 23:51:04 +01:00
Sebastiaan van Stijn
8a1b096e76 docs: fix missing anchors in swarm reference pages
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-21 23:46:07 +01:00
Sebastiaan van Stijn
c99d3312eb docs: fix broken anchor-link in "container restart" reference
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-21 23:45:32 +01:00
Sarah Sanders
f977b923cd Fix missing link from Configure node healthcheck heading
Update name to dispatcher-heartbeat

Signed-off-by: Sarah Sanders <sarah.sanders@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-19 16:56:28 +01:00
Alano Terblanche
6d7afd48a4 login: improve text on already authenticated and on OAuth login
Users have trouble understanding the different login paths on the CLI.
The default login is performed through an OAuth flow with the option to
fallback to a username and PAT login using the docker login -u <username>
option.

This patch improves the text around docker login, indicating:
- The username is shown when already authenticated
- Steps the user can take to switch user accounts are printed when
  authenticated in an info.
- When not authenticated, the OAuth login flow explains the fallback
  clearly to the user in an info.
- The password prompt now explicitly states that it accepts a PAT in an
  info.

Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
2025-02-05 12:32:24 +01:00
Sebastiaan van Stijn
987da09578 cli/command/volume: remove example and var for long description
This was the only command for which we set the "example" field; while
we could consider doing this for other commands, we need to look what's
best w.r.t. duplicating the information maintained in markdown.

Also remove the intermediate variable used for the long description,
as this was also the only location where we used one.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-03 12:21:00 +01:00
Sebastiaan van Stijn
7b7a4c020e docs, man: remove confusing example for "--isolation"
This snippet was added in [docker@38ec5d8][1]. The intent was to indicate
that an empty value is equivalent to passing "default" as value. However,
passing the `--isolation` flag _without a value_ (i.e., no `=` specified)
will fail in many cases, as any string after it will be parsed as value
(e.g. `docker run --isolation busybox` would consider `busybox` as value).

This patch removes these lines as they add more confusion than addressing.

[1]: 38ec5d86a3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-02 12:15:08 +01:00
Rob Murray
6a2cde6c75 Add option '--ipv4'
Signed-off-by: Rob Murray <rob.murray@docker.com>
2024-12-10 15:51:21 +00:00