Merge pull request #18899 from thaJeztah/update_cli_reference

update engine docs and cli reference
This commit is contained in:
David Karlsson 2023-12-11 22:29:16 +01:00 committed by GitHub
commit d16c531c59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 79 additions and 66 deletions

View File

@ -821,9 +821,7 @@ Because of which, the driver specific log tag options `syslog-tag`, `gelf-tag` a
`fluentd-tag` have been deprecated in favor of the generic `tag` option.
```console
{% raw %}
$ docker --log-driver=syslog --log-opt tag="{{.ImageName}}/{{.Name}}/{{.ID}}"
{% endraw %}
```

View File

@ -1,5 +1,5 @@
---
redirect_from:
aliases:
- "/engine/extend/plugins/"
description: "How to add additional functionality to Docker with plugins extensions"
keywords: "Examples, Usage, plugins, docker, documentation, user guide"

View File

@ -1,7 +1,7 @@
---
description: "How to create authorization plugins to manage access control to your Docker daemon."
keywords: "security, authorization, authentication, docker, documentation, plugin, extend"
redirect_from:
aliases:
- "/engine/extend/authorization/"
---

View File

@ -311,9 +311,7 @@ and `Parent`. `Parent` may be an empty string, in which case there is no parent.
**Response**:
```
{% raw %}
{{ TAR STREAM }}
{% endraw %}
```
### /GraphDriver.Changes
@ -357,9 +355,7 @@ Respond with a non-empty string error if an error occurred.
**Request**:
```
{% raw %}
{{ TAR STREAM }}
{% endraw %}
```
Extract the changeset from the given diff into the layer with the specified `ID`

View File

@ -213,7 +213,7 @@ to determine what set of logs to read.
**Response**:
```
{% raw %}{{ log stream }}{% endraw %}
{{ log stream }}
```
The response should be the encoded log message using the same format as the

View File

@ -69,10 +69,8 @@ node1 is the manager and node2 is the worker.
4. Observe the task getting scheduled in node 2:
```console
{% raw %}
$ docker ps --format '{{.ID}}\t {{.Status}} {{.Names}} {{.Command}}'
83fc1e842599 Up 2 days my-service.1.9jn59qzn7nbc3m0zt1hij12xs "top"
{% endraw %}
```
### Network plugins

View File

@ -2,7 +2,7 @@
title: "Use the Docker command line"
description: "Docker's CLI command description and usage"
keywords: "Docker, Docker documentation, CLI, command line, config.json, CLI configuration file"
redirect_from:
aliases:
- /reference/commandline/cli/
- /engine/reference/commandline/engine/
- /engine/reference/commandline/engine_activate/
@ -156,7 +156,7 @@ By default, the Docker command line stores its configuration files in a
directory called `.docker` within your `$HOME` directory.
Docker manages most of the files in the configuration directory
and you should not modify them. However, you *can* modify the
and you should not modify them. However, you can modify the
`config.json` file to control certain aspects of how the `docker`
command behaves.
@ -313,7 +313,6 @@ Following is a sample `config.json` file to illustrate the format used for
various fields:
```json
{% raw %}
{
"HttpHeaders": {
"MyHeader": "MyValue"
@ -356,7 +355,6 @@ various fields:
}
}
}
{% endraw %}
```
### Experimental features

View File

@ -2,7 +2,7 @@
title: "dockerd"
description: "The daemon command description and usage"
keywords: "container, daemon, runtime"
redirect_from:
aliases:
- /engine/reference/commandline/daemon/
---
@ -205,7 +205,7 @@ find examples of using Systemd socket activation with Docker and Systemd in the
You can configure the Docker daemon to listen to multiple sockets at the same
time using multiple `-H` options:
The example below runs the daemon listenin on the default unix socket, and
The example below runs the daemon listening on the default unix socket, and
on 2 specific IP addresses on this host:
```console

View File

@ -1,7 +1,7 @@
---
description: "Configure containers at runtime"
keywords: "docker, run, configure, runtime"
redirect_from:
aliases:
- /reference/run/
---
@ -570,19 +570,15 @@ for a container can be obtained via [`docker inspect`](commandline/inspect.md).
for container "my-container";
```console
{% raw %}
$ docker inspect -f "{{ .RestartCount }}" my-container
# 2
{% endraw %}
```
Or, to get the last time the container was (re)started;
```console
{% raw %}
$ docker inspect -f "{{ .State.StartedAt }}" my-container
# 2015-03-04T23:47:07.691840179Z
{% endraw %}
```
Combining `--restart` (restart policy) with the `--rm` (clean up) flag results
@ -1646,7 +1642,6 @@ Similarly the operator can set the **HOSTNAME** (Linux) or **COMPUTERNAME** (Win
Example:
```console
{% raw %}
$ docker run --name=test -d \
--health-cmd='stat /etc/passwd || exit 1' \
--health-interval=2s \
@ -1691,7 +1686,6 @@ $ sleep 2; docker inspect --format='{{json .State.Health}}' test
}
]
}
{% endraw %}
```
The health status is also displayed in the `docker ps` output.

View File

@ -2,6 +2,6 @@
# github.com/moby/buildkit v0.13.0-beta1.0.20231113205014-1efcd30d9dd6
# github.com/docker/buildx v0.12.0
# github.com/docker/scout-cli v1.2.0
# github.com/docker/cli v24.0.8-0.20231106123152-48ec4f339e2b+incompatible
# github.com/docker/cli v24.0.8-0.20231211210310-fb2f337bc1b1+incompatible
# github.com/compose-spec/compose-spec v0.0.0-20231121152139-478928e7c9f8
# github.com/docker/compose/v2 v2.23.3

View File

@ -141,7 +141,7 @@ options:
swarm: false
- option: cgroup-parent
value_type: string
description: Optional parent cgroup for the container
description: Set the parent cgroup for the `RUN` instructions during build
details_url: '#cgroup-parent'
deprecated: false
hidden: false

View File

@ -36,7 +36,7 @@ options:
swarm: false
- option: cgroup-parent
value_type: string
description: Optional parent cgroup for the container
description: Set the parent cgroup for the `RUN` instructions during build
deprecated: false
hidden: false
experimental: false

View File

@ -6,7 +6,7 @@ long: |-
By default, this renders all results in a JSON array. If a format is specified,
the given template will be executed for each result.
Go's [text/template](https://golang.org/pkg/text/template/) package
Go's [text/template](https://pkg.go.dev/text/template) package
describes all the details of the format.
For detailed information about using configs, refer to [store configuration data using Docker Configs](/engine/swarm/configs/).

View File

@ -175,7 +175,7 @@ long: |-
If a format (`--format`) is specified, the given template will be executed
instead of the default
format. Go's [text/template](https://golang.org/pkg/text/template/) package
format. Go's [text/template](https://pkg.go.dev/text/template) package
describes all the details of the format.
If a format is set to `{{json .}}`, the events are streamed as valid JSON
@ -196,7 +196,11 @@ options:
swarm: false
- option: format
value_type: string
description: Format the output using the given Go template
description: |-
Format output using a custom template:
'json': Print in JSON format
'TEMPLATE': Print output using the given Go template.
Refer to https://docs.docker.com/go/formatting/ for more information about formatting output with templates
deprecated: false
hidden: false
experimental: false
@ -432,8 +436,11 @@ examples: |-
#### Format as JSON
To list events in JSON format, use the `json` directive, which is the equivalent
of `--format '{{ json . }}`.
```console
$ docker events --format '{{json .}}'
$ docker events --format json
{"status":"create","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f4..
{"status":"attach","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f4..
@ -441,6 +448,8 @@ examples: |-
{"status":"start","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f42..
{"status":"resize","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f4..
```
.
deprecated: false
experimental: false
experimentalcli: false

View File

@ -162,10 +162,10 @@ examples: |-
Next, set environment variables in the current bash session.
By default, the `docker exec` command, inherits the environment variables that
are set at the time the container is created. Use the `--env` (or the `-e` shorthand)
to override global environment variables, or to set additional environment variables
for the process started by `docker exec`.
The `docker exec` command inherits the environment variables that are set at the
time the container is created. Use the `--env` (or the `-e` shorthand) to
override global environment variables, or to set additional environment
variables for the process started by `docker exec`.
The example below creates a new shell session in the container `mycontainer` with
environment variables `$VAR_A` and `$VAR_B` set to "1" and "2" respectively.

View File

@ -36,7 +36,7 @@ options:
swarm: false
- option: cgroup-parent
value_type: string
description: Optional parent cgroup for the container
description: Set the parent cgroup for the `RUN` instructions during build
deprecated: false
hidden: false
experimental: false

View File

@ -8,7 +8,7 @@ long: |-
under different names is counted only once.
If a format is specified, the given template will be executed instead of the
default format. Go's [text/template](https://golang.org/pkg/text/template/) package
default format. Go's [text/template](https://pkg.go.dev/text/template) package
describes all the details of the format.
Depending on the storage driver in use, additional information can be shown, such

View File

@ -9,7 +9,7 @@ long: |-
If a format is specified, the given template will be executed for each result.
Go's [text/template](https://golang.org/pkg/text/template/) package describes
Go's [text/template](https://pkg.go.dev/text/template) package describes
all the details of the format.
### Specify target type (--type) {#type}

View File

@ -3,7 +3,7 @@ aliases: docker image load, docker load
short: Load an image from a tar archive or STDIN
long: |-
Load an image or repository from a tar archive (even if compressed with gzip,
bzip2, or xz) from a file or STDIN. It restores both images and tags.
bzip2, xz or zstd) from a file or STDIN. It restores both images and tags.
usage: docker load [OPTIONS]
pname: docker
plink: docker.yaml

View File

@ -13,7 +13,7 @@ long: |-
Passing a negative number or a non-integer to `--tail` is invalid and the
value is set to `all` in that case.
The `docker logs --timestamps` command will add an [RFC3339Nano timestamp](https://golang.org/pkg/time/#pkg-constants)
The `docker logs --timestamps` command will add an [RFC3339Nano timestamp](https://pkg.go.dev/time#RFC3339Nano)
, for example `2014-09-16T06:17:46.000000000Z`, to each
log entry. To ensure that the timestamps are aligned the
nano-second part of the timestamp will be padded with zero when necessary.

View File

@ -4,7 +4,7 @@ long: |-
Returns information about a node. By default, this command renders all results
in a JSON array. You can specify an alternate format to execute a
given template for each result. Go's
[text/template](https://golang.org/pkg/text/template/) package describes all the
[text/template](https://pkg.go.dev/text/template) package describes all the
details of the format.
> **Note**

View File

@ -262,9 +262,19 @@ examples: |-
#### status
The `status` filter matches containers by status. You can filter using
`created`, `restarting`, `running`, `removing`, `paused`, `exited` and `dead`. For example,
to filter for `running` containers:
The `status` filter matches containers by status. The possible values for the container status are:
| Status | Description |
| :----------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `created` | A container that has never been started. |
| `running` | A running container, started by either `docker start` or `docker run`. |
| `paused` | A paused container. See `docker pause`. |
| `restarting` | A container which is starting due to the designated restart policy for that container. |
| `exited` | A container which is no longer running. For example, the process inside the container completed or the container was stopped using the `docker stop` command. |
| `removing` | A container which is in the process of being removed. See `docker rm`. |
| `dead` | A "defunct" container; for example, a container that was only partially removed because resources were kept busy by an external process. `dead` containers cannot be (re)started, only removed. |
For example, to filter for `running` containers:
```console
$ docker ps --filter status=running

View File

@ -104,18 +104,18 @@ examples: |-
Docker images can consist of multiple layers. In the example above, the image
consists of a single layer; `e756f3fdd6a3`.
Layers can be reused by images. For example, the `debian:bullseye` image shares
its layer with the `debian:latest`. Pulling the `debian:bullseye` image therefore
Layers can be reused by images. For example, the `debian:bookworm` image shares
its layer with the `debian:latest`. Pulling the `debian:bookworm` image therefore
only pulls its metadata, but not its layers, because the layer is already present
locally:
```console
$ docker image pull debian:bullseye
$ docker image pull debian:bookworm
bullseye: Pulling from library/debian
bookworm: Pulling from library/debian
Digest: sha256:3f1d6c17773a45c97bd8f158d665c9709d7b29ed7917ac934086ad96f92e4510
Status: Downloaded newer image for debian:bullseye
docker.io/library/debian:bullseye
Status: Downloaded newer image for debian:bookworm
docker.io/library/debian:bookworm
```
To see which images are present locally, use the [`docker images`](images.md)
@ -125,13 +125,13 @@ examples: |-
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
debian bullseye 4eacea30377a 8 days ago 124MB
debian bookworm 4eacea30377a 8 days ago 124MB
debian latest 4eacea30377a 8 days ago 124MB
```
Docker uses a content-addressable image store, and the image ID is a SHA256
digest covering the image's configuration and layers. In the example above,
`debian:bullseye` and `debian:latest` have the same image ID because they are
`debian:bookworm` and `debian:latest` have the same image ID because they are
the *same* image tagged with different names. Because they are the same image,
their layers are stored only once and do not consume extra disk space.

View File

@ -1360,6 +1360,8 @@ examples: |-
You can also load the environment variables from a file. This file should use
the syntax `<variable>=value` (which sets the variable to the given value) or
`<variable>` (which takes the value from the local environment), and `#` for comments.
Additionally, it's important to note that lines beginning with `#` are treated as line comments
and are ignored, whereas a `#` appearing anywhere else in a line is treated as part of the variable value.
```console
$ cat env.list
@ -1622,7 +1624,7 @@ examples: |-
following rule:
```console
$ docker run -d --device-cgroup-rule='c 42:* rmw' -name my-container my-image
$ docker run -d --device-cgroup-rule='c 42:* rmw' --name my-container my-image
```
Then, a user could ask `udev` to execute a script that would `docker exec my-container mknod newDevX c 42 <minor>`

View File

@ -6,7 +6,7 @@ long: |-
By default, this renders all results in a JSON array. If a format is specified,
the given template will be executed for each result.
Go's [text/template](https://golang.org/pkg/text/template/) package
Go's [text/template](https://pkg.go.dev/text/template) package
describes all the details of the format.
For detailed information about using secrets, refer to [manage sensitive data with Docker secrets](/engine/swarm/secrets/).

View File

@ -1682,7 +1682,7 @@ examples: |-
### Create services using templates
You can use templates for some flags of `service create`, using the syntax
provided by the Go's [text/template](https://golang.org/pkg/text/template/) package.
provided by the Go's [text/template](https://pkg.go.dev/text/template) package.
The supported flags are the following :

View File

@ -6,7 +6,7 @@ long: |-
By default, this renders all results in a JSON array. If a format is specified,
the given template will be executed for each result.
Go's [text/template](https://golang.org/pkg/text/template/) package
Go's [text/template](https://pkg.go.dev/text/template) package
describes all the details of the format.
> **Note**

View File

@ -29,7 +29,7 @@ long: |-
Passing a negative number or a non-integer to `--tail` is invalid and the
value is set to `all` in that case.
The `docker service logs --timestamps` command will add an [RFC3339Nano timestamp](https://golang.org/pkg/time/#pkg-constants)
The `docker service logs --timestamps` command will add an [RFC3339Nano timestamp](https://pkg.go.dev/time#RFC3339Nano)
, for example `2014-09-16T06:17:46.000000000Z`, to each
log entry. To ensure that the timestamps are aligned the
nano-second part of the timestamp will be padded with zero when necessary.

View File

@ -140,7 +140,11 @@ options:
swarm: false
- option: format
value_type: string
description: Format the output using the given Go template
description: |-
Format output using a custom template:
'json': Print in JSON format
'TEMPLATE': Print output using the given Go template.
Refer to https://docs.docker.com/go/formatting/ for more information about formatting output with templates
details_url: '#format'
deprecated: false
hidden: false
@ -340,7 +344,7 @@ examples: |-
### Format the output (--format) {#format}
If a format (`--format`) is specified, the given template will be executed
instead of the default format. Go's [text/template](https://golang.org/pkg/text/template/)
instead of the default format. Go's [text/template](https://pkg.go.dev/text/template)
package describes all the details of the format.
```console

View File

@ -43,7 +43,7 @@ options:
- option: volumes
value_type: bool
default_value: "false"
description: Prune volumes
description: Prune anonymous volumes
deprecated: false
hidden: false
experimental: false
@ -90,7 +90,7 @@ examples: |-
By default, volumes are not removed to prevent important data from being
deleted if there is currently no container using the volume. Use the `--volumes`
flag when running the command to prune volumes as well:
flag when running the command to prune anonymous volumes as well:
```console
$ docker system prune -a --volumes
@ -98,7 +98,7 @@ examples: |-
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all volumes not used by at least one container
- all anonymous volumes not used by at least one container
- all images without at least one container associated to them
- all build cache
Are you sure you want to continue? [y/N] y

View File

@ -13,7 +13,7 @@ long: |-
canonical reference for Docker's public registry.
- `PORT_NUMBER`: If a hostname is present, it may optionally be followed by a
registry port number in the format `:8080`.
- `PATH`: The path consists consists of slash-separated components. Each
- `PATH`: The path consists of slash-separated components. Each
component may contain lowercase letters, digits and separators. A separator is
defined as a period, one or two underscores, or one or more hyphens. A component
may not start or end with a separator. While the

View File

@ -4,7 +4,7 @@ long: |-
Returns information about a volume. By default, this command renders all results
in a JSON array. You can specify an alternate format to execute a
given template for each result. Go's
[text/template](https://golang.org/pkg/text/template/) package describes all the
[text/template](https://pkg.go.dev/text/template) package describes all the
details of the format.
usage: docker volume inspect [OPTIONS] VOLUME [VOLUME...]
pname: docker volume

View File

@ -1,5 +1,5 @@
command: docker volume prune
short: Remove all unused local volumes
short: Remove unused local volumes
long: |-
Remove all unused local volumes. Unused local volumes are those which are not
referenced by any containers. By default, it only removes anonymous volumes.

2
go.mod
View File

@ -7,7 +7,7 @@ toolchain go1.21.1
require (
github.com/compose-spec/compose-spec v0.0.0-20231121152139-478928e7c9f8 // indirect
github.com/docker/buildx v0.12.0 // indirect
github.com/docker/cli v24.0.8-0.20231106123152-48ec4f339e2b+incompatible // indirect
github.com/docker/cli v24.0.8-0.20231211210310-fb2f337bc1b1+incompatible // indirect
github.com/docker/compose/v2 v2.23.3 // indirect
github.com/docker/scout-cli v1.2.0 // indirect
github.com/moby/buildkit v0.13.0-beta1.0.20231113205014-1efcd30d9dd6 // indirect

4
go.sum
View File

@ -62,6 +62,10 @@ github.com/docker/cli v24.0.6+incompatible h1:fF+XCQCgJjjQNIMjzaSmiKJSCcfcXb3TWT
github.com/docker/cli v24.0.6+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
github.com/docker/cli v24.0.8-0.20231106123152-48ec4f339e2b+incompatible h1:tXZk7C97vINae9YYzPtqoClal32VoMl8gz6gLjJ6Kdg=
github.com/docker/cli v24.0.8-0.20231106123152-48ec4f339e2b+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
github.com/docker/cli v24.0.8-0.20231211210310-fb2f337bc1b1+incompatible h1:3hcKPFXxdqoVzoIrjNF1NNb36kzFiEimwUegOhw0pC0=
github.com/docker/cli v24.0.8-0.20231211210310-fb2f337bc1b1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
github.com/docker/cli v25.0.0-beta.1+incompatible h1:bJzIgR4mKNpceAwwi19SqZK0AbztMc3nQTgnvxxyY/A=
github.com/docker/cli v25.0.0-beta.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
github.com/docker/compose-cli v1.0.35 h1:uZyEHLalfqBS2PiTpA1LAULyJmuQ+YtZg7nG4Xl3/Cc=
github.com/docker/compose-cli v1.0.35/go.mod h1:mSXI4hFLpRU3EtI8NTo32bNwI0UXSr8jnq+/rYjGAUU=
github.com/docker/compose/v2 v2.22.0 h1:3rRz4L7tPU75wRsV8JZh2/aTgerQvPa1cpzZN+tHqUY=