1
0
mirror of https://github.com/docker/cli.git synced 2025-04-20 06:27:49 +03:00

1534 Commits

Author SHA1 Message Date
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
Rob Murray
5c896c95d0 Docs: emphasise that some options that are for docker0
Signed-off-by: Rob Murray <rob.murray@docker.com>
2024-12-10 15:51:21 +00:00
Rob Murray
a5353e55da Docs: include --fixed-cidr-v6 and --bip6 docker0 options
Signed-off-by: Rob Murray <rob.murray@docker.com>
2024-12-10 09:44:59 +00:00
Albin Kerouanton
d4db289eb5 run, create, connect: add support for gw-priority
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2024-12-03 15:13:08 +01:00
aevesdocker
1440f9f8cf docs: change link to desktop docs
Signed-off-by: aevesdocker <allie.sadler@docker.com>
2024-11-07 09:38:19 +00:00
David Karlsson
172f340112 docs: update example redis tags from 3.0.x to 7.4.x
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-11-05 11:20:17 +01:00
Sebastiaan van Stijn
e9ae9f788b
docker inspect: add support for swarm configs
The docker inspect command did not inspect configs. This patch adds support for
it, and while at it, also sorts the list of objects in runInspect.

Before this patch:

    docker config create myconfig ./codecov.yml
    danpeyh8qzb30vgdj9fr665l1

    docker inspect --format='{{.ID}}' myconfig
    []
    Error: No such object: myconfig

    docker inspect --format='{{.ID}}' --type=config myconfig
    "config" is not a valid value for --type

With this patch:

    docker inspect --format='{{.ID}}' myconfig
    danpeyh8qzb30vgdj9fr665l1

    docker inspect --format='{{.ID}}' --type=config myconfig
    danpeyh8qzb30vgdj9fr665l1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-24 18:32:32 +02:00
Paweł Gronowski
3590f946a3
Merge pull request #5535 from dvdksn/fix-image-tag-spec
docs: update prose about image tag/name format
2024-10-17 12:46:46 +02:00
David Karlsson
2c6b80491b docs: update prose about image tag/name format
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-10-17 12:36:32 +02:00
David Karlsson
50ef0c58c2 docs: corrected the max events returned
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-10-16 12:21:51 +02:00
Sebastiaan van Stijn
88f1e99e8e
Merge pull request #5507 from p-rogalski/link-supported-go-duration-strings
docs: Link supported Go duration strings
2024-10-10 18:04:19 +02:00
Paweł Gronowski
d085e2445c
image/history: Add --platform flag
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-10 17:00:43 +02:00
Paweł Gronowski
b0bb4ba7f2
image/load: Add --platform
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-10 16:35:07 +02:00
Paweł Gronowski
a20eb45b26
image/save: Add --platform
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-10 16:35:03 +02:00
David Karlsson
2f2b16a966 docs: fix inaccurate description of --restart=unless-stopped
`unless-stopped` containers are not restart after a daemon restart

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-10-07 13:07:33 +02:00
Paul Rogalski
c70b2165a9 docs: Link supported Go duration strings
Signed-off-by: Paul Rogalski <mail@paul-rogalski.de>
2024-10-07 10:37:00 +02:00
Sebastiaan van Stijn
9025c932b9
Merge pull request #5469 from dvdksn/docs-use-important-callout-legacy-build
docs: use important callout for buildkit vs legacy builder
2024-10-04 13:05:52 +02:00
Sebastiaan van Stijn
df8b34595b
cli/command/container: stop, restart: rename "--time" to "--timeout"
This renames the `--time` flag as used on `docker stop` and `docker restart`
to `--timeout`,  bringing it in line with other uses for this property,
such as `--stop-timeout` on `docker run`.

The `--time` option is deprecated and hidden, but will be kept for
backward compatibility, as these options existed for a long time.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-09-30 09:43:54 +02:00
Sebastiaan van Stijn
6075303483
docs/reference: stop, restart: add flag descriptions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-09-27 10:18:55 +02:00
David Karlsson
465e87afc7 docs: fix anchor link to web-based login section
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-09-23 13:48:33 +02:00
David Karlsson
8a3d838a19 docs: use important callout for buildkit vs legacy builder
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-09-23 13:38:33 +02:00
Julio Cesar Garcia
605c9bf160 docs: Fix --rm=false flag in container_run.md
Signed-off-by: Julio Cesar Garcia <juliogarciamelgarejo@gmail.com>
2024-09-13 18:45:26 -05:00
David Karlsson
81744d7aa8 copynit: s/WEB BASED/WEB-BASED/
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-09-03 11:39:43 +02:00
David Karlsson
2f206fff3c docs: update docker login reference
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-09-03 11:38:05 +02:00
David Karlsson
436080b887
Merge pull request #5360 from dvdksn/update-apireference-link
chore: update link to docker engine api reference
2024-08-22 15:17:45 +02:00
David Karlsson
35626bae8a
Merge pull request #5350 from dvdksn/docs-alerts-syntax
docs: use gh alert syntax for callouts
2024-08-21 11:39:45 +02:00
David Karlsson
c974a83391 chore: update link to docker engine api reference
Engine API reference page is moving to /reference/api/engine

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-08-20 12:35:04 +02:00
David Karlsson
0be9e2faaa
Merge pull request #5347 from dvdksn/update-build-context-link
docs: update link to moved build context doc
2024-08-19 13:13:31 +02:00
Paweł Gronowski
be11b74ee9
image/list: Add --tree flag
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-08-16 15:09:51 +02:00
David Karlsson
f1befabe9f docs: use gh alert syntax for callouts
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-08-16 11:02:10 +02:00
David Karlsson
2dd4eb06ae docs: update link to moved build context doc
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-08-13 11:48:29 +02:00
David Karlsson
d4a362aa1c docs: update internal links after refactor
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-08-11 16:58:08 +02:00
David Karlsson
78a8fba2cc docs: fix link to http proxy document
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-08-09 18:19:58 +02:00
Sebastiaan van Stijn
b36522b473
docs: refresh image versions in examples
use current LTS versions of ubuntu where suitable, remove uses of
ubuntu:23.10 (which reache EOL), and and update some other examples
to use more current versions.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-24 09:47:36 +02:00
Sebastiaan van Stijn
6559d86217
Merge pull request #5145 from psaintlaurent/ENGINE-903
Add OomScoreAdj to "docker service create" and "docker compose"
2024-07-19 19:09:28 +02:00
plaurent
aa2c2cd906 Allow for OomScoreAdj
Signed-off-by: plaurent <patrick@saint-laurent.us>
2024-07-19 13:02:01 -04:00
Sebastiaan van Stijn
6638deb9d6
add support for DOCKER_CUSTOM_HEADERS env-var (experimental)
This environment variable allows for setting additional headers
to be sent by the client. Headers set through this environment
variable are added to headers set through the config-file (through
the HttpHeaders field).

This environment variable can be used in situations where headers
must be set for a specific invocation of the CLI, but should not
be set by default, and therefore cannot be set in the config-file.

WARNING: If both config and environment-variable are set, the environment
variable currently overrides all headers set in the configuration file.
This behavior may change in a future update, as we are considering the
environment variable to be appending to existing headers (and to only
override headers with the same name).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 15:04:26 +02:00