Update engine CLI reference with latest changes from 19.03

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2020-09-29 22:05:28 +02:00
parent 83260432b8
commit cba2011b34
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
30 changed files with 261 additions and 163 deletions

View File

@ -52,6 +52,11 @@ long: |-
`myrepo.git#mytag:myfolder` | `refs/tags/mytag` | `/myfolder`
`myrepo.git#mybranch:myfolder` | `refs/heads/mybranch` | `/myfolder`
> **Note**
>
> You cannot specify the build-context directory (`myfolder` in the examples above)
> when using BuildKit as builder (`DOCKER_BUILDKIT=1`). Support for this feature
> is tracked in [buildkit#1684](https://github.com/moby/buildkit/issues/1684).
### Tarball contexts
@ -623,14 +628,15 @@ examples: |-
directory structure of the build context, regardless of how you refer to it on
the command line.
> **Note:**
> `docker build` will return a `no such file or directory` error if the
> **Note**
>
> `docker build` returns a `no such file or directory` error if the
> file or directory does not exist in the uploaded context. This may
> happen if there is no context, or if you specify a file that is
> elsewhere on the Host system. The context is limited to the current
> directory (and its children) for security reasons, and to ensure
> repeatable builds on remote Docker hosts. This is also the reason why
> `ADD ../file` will not work.
> `ADD ../file` does not work.
### Use a custom parent cgroup (--cgroup-parent)
@ -911,30 +917,47 @@ examples: |-
#### Prerequisites
The example on this page is using experimental mode in Docker 1.13.
The example on this page is using experimental mode in Docker 19.03.
Experimental mode can be enabled by using the `--experimental` flag when starting the Docker daemon or setting `experimental: true` in the `daemon.json` configuration file.
Experimental mode can be enabled by using the `--experimental` flag when starting
the Docker daemon or setting `experimental: true` in the `daemon.json` configuration
file.
By default, experimental mode is disabled. To see the current configuration, use the `docker version` command.
By default, experimental mode is disabled. To see the current configuration of
the docker daemon, use the `docker version` command and check the `Experimental`
line in the `Engine` section:
```none
Server:
Version: 1.13.1
API version: 1.26 (minimum version 1.12)
Go version: go1.7.5
Git commit: 092cba3
Built: Wed Feb 8 06:35:24 2017
OS/Arch: linux/amd64
Experimental: false
```console
Client: Docker Engine - Community
Version: 19.03.8
API version: 1.40
Go version: go1.12.17
Git commit: afacb8b
Built: Wed Mar 11 01:21:11 2020
OS/Arch: darwin/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.8
API version: 1.40 (minimum version 1.12)
Go version: go1.12.17
Git commit: afacb8b
Built: Wed Mar 11 01:29:16 2020
OS/Arch: linux/amd64
Experimental: true
[...]
```
To enable experimental mode, users need to restart the docker daemon with the experimental flag enabled.
To enable experimental mode, users need to restart the docker daemon with the
experimental flag enabled.
#### Enable Docker experimental
Experimental features are now included in the standard Docker binaries as of version 1.13.0. For enabling experimental features, you need to start the Docker daemon with `--experimental` flag. You can also enable the daemon flag via /etc/docker/daemon.json. e.g.
Experimental features are now included in the standard Docker binaries as of
version 1.13.0. For enabling experimental features, you need to start the
Docker daemon with `--experimental` flag. You can also enable the daemon flag
via `/etc/docker/daemon.json`. e.g.
```json
{
@ -958,7 +981,7 @@ examples: |-
RUN echo hello > /hello
RUN echo world >> /hello
RUN touch remove_me /remove_me
ENV HELLO world
ENV HELLO=world
RUN rm /remove_me
```
@ -970,7 +993,7 @@ examples: |-
[...]
```
If everything is right, the history will look like this:
If everything is right, the history looks like this:
```bash
$ docker history test
@ -986,9 +1009,11 @@ examples: |-
<missing> 7 weeks ago /bin/sh -c #(nop) ADD file:47ca6e777c36a4cfff 1.113 MB
```
We could find that all layer's name is `<missing>`, and there is a new layer with COMMENT `merge`.
We could find that a layer's name is `<missing>`, and there is a new layer with
COMMENT `merge`.
Test the image, check for `/remove_me` being gone, make sure `hello\nworld` is in `/hello`, make sure the `HELLO` envvar's value is `world`.
Test the image, check for `/remove_me` being gone, make sure `hello\nworld` is
in `/hello`, make sure the `HELLO` environment variable's value is `world`.
deprecated: false
experimental: false
experimentalcli: false

View File

@ -92,7 +92,7 @@ examples: |-
[HOME=/ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin]
$ docker commit --change "ENV DEBUG true" c3f279d17e0a svendowideit/testimage:version3
$ docker commit --change "ENV DEBUG=true" c3f279d17e0a svendowideit/testimage:version3
f5283438590d

View File

@ -3,64 +3,6 @@ short: Create a context
long: |-
Creates a new `context`. This allows you to quickly switch the cli
configuration to connect to different clusters or single nodes.
To create a context from scratch provide the docker and, if required,
kubernetes options. The example below creates the context `my-context`
with a docker endpoint of `/var/run/docker.sock` and a kubernetes configuration
sourced from the file `/home/me/my-kube-config`:
```bash
$ docker context create my-context \
--docker host=/var/run/docker.sock \
--kubernetes config-file=/home/me/my-kube-config
```
Use the `--from=<context-name>` option to create a new context from
an existing context. The example below creates a new context named `my-context`
from the existing context `existing-context`:
```bash
$ docker context create my-context --from existing-context
```
If the `--from` option is not set, the `context` is created from the current context:
```bash
$ docker context create my-context
```
This can be used to create a context out of an existing `DOCKER_HOST` based script:
```bash
$ source my-setup-script.sh
$ docker context create my-context
```
To source only the `docker` endpoint configuration from an existing context
use the `--docker from=<context-name>` option. The example below creates a
new context named `my-context` using the docker endpoint configuration from
the existing context `existing-context` and a kubernetes configuration sourced
from the file `/home/me/my-kube-config`:
```bash
$ docker context create my-context \
--docker from=existing-context \
--kubernetes config-file=/home/me/my-kube-config
```
To source only the `kubernetes` configuration from an existing context use the
`--kubernetes from=<context-name>` option. The example below creates a new
context named `my-context` using the kuberentes configuration from the existing
context `existing-context` and a docker endpoint of `/var/run/docker.sock`:
```bash
$ docker context create my-context \
--docker host=/var/run/docker.sock \
--kubernetes from=existing-context
```
Docker and Kubernetes endpoints configurations, as well as default stack
orchestrator and description can be modified with `docker context update`
usage: docker context create [OPTIONS] CONTEXT
pname: docker context
plink: docker_context.yaml
@ -108,6 +50,73 @@ options:
experimentalcli: false
kubernetes: false
swarm: false
examples: |-
### Create a context with a docker and kubernetes endpoint
To create a context from scratch provide the docker and, if required,
kubernetes options. The example below creates the context `my-context`
with a docker endpoint of `/var/run/docker.sock` and a kubernetes configuration
sourced from the file `/home/me/my-kube-config`:
```bash
$ docker context create \
--docker host=unix:///var/run/docker.sock \
--kubernetes config-file=/home/me/my-kube-config \
my-context
```
### Create a context based on an existing context
Use the `--from=<context-name>` option to create a new context from
an existing context. The example below creates a new context named `my-context`
from the existing context `existing-context`:
```bash
$ docker context create --from existing-context my-context
```
If the `--from` option is not set, the `context` is created from the current context:
```bash
$ docker context create my-context
```
This can be used to create a context out of an existing `DOCKER_HOST` based script:
```bash
$ source my-setup-script.sh
$ docker context create my-context
```
To source only the `docker` endpoint configuration from an existing context
use the `--docker from=<context-name>` option. The example below creates a
new context named `my-context` using the docker endpoint configuration from
the existing context `existing-context` and a kubernetes configuration sourced
from the file `/home/me/my-kube-config`:
```bash
$ docker context create \
--docker from=existing-context \
--kubernetes config-file=/home/me/my-kube-config \
my-context
```
To source only the `kubernetes` configuration from an existing context use the
`--kubernetes from=<context-name>` option. The example below creates a new
context named `my-context` using the kuberentes configuration from the existing
context `existing-context` and a docker endpoint of `/var/run/docker.sock`:
```bash
$ docker context create \
--docker host=unix:///var/run/docker.sock \
--kubernetes from=existing-context \
my-context
```
Docker and Kubernetes endpoints configurations, as well as default stack
orchestrator and description can be modified with `docker context update`.
Refer to the [`docker context update` reference](context_update.md) for details.
deprecated: false
experimental: false
experimentalcli: false

View File

@ -1,8 +1,9 @@
command: docker context export
short: Export a context to a tar or kubeconfig file
long: |-
Exports a context in a file that can then be used with `docker context import` (or with `kubectl` if `--kubeconfig` is set).
Default output filename is `<CONTEXT>.dockercontext`, or `<CONTEXT>.kubeconfig` if `--kubeconfig` is set.
Exports a context in a file that can then be used with `docker context import`
(or with `kubectl` if `--kubeconfig` is set). Default output filename is
`<CONTEXT>.dockercontext`, or `<CONTEXT>.kubeconfig` if `--kubeconfig` is set.
To export to `STDOUT`, you can run `docker context export my-context -`.
usage: docker context export [OPTIONS] CONTEXT [FILE|-]
pname: docker context

View File

@ -1,6 +1,7 @@
command: docker context import
short: Import a context from a tar or zip file
long: Imports a context previously exported with `docker context export`. To import
long: |-
Imports a context previously exported with `docker context export`. To import
from stdin, use a hyphen (`-`) as filename.
usage: docker context import CONTEXT FILE|-
pname: docker context

View File

@ -21,35 +21,35 @@ examples: |-
$ docker context inspect "local+aks"
[
{
"Name": "local+aks",
"Metadata": {
"Description": "Local Docker Engine + Azure AKS endpoint",
"StackOrchestrator": "kubernetes"
},
"Endpoints": {
"docker": {
"Host": "npipe:////./pipe/docker_engine",
"SkipTLSVerify": false
},
"kubernetes": {
"Host": "https://simon-aks-***.hcp.uksouth.azmk8s.io:443",
"SkipTLSVerify": false,
"DefaultNamespace": "default"
}
},
"TLSMaterial": {
"kubernetes": [
"ca.pem",
"cert.pem",
"key.pem"
]
},
"Storage": {
"MetadataPath": "C:\\Users\\simon\\.docker\\contexts\\meta\\cb6d08c0a1bfa5fe6f012e61a442788c00bed93f509141daff05f620fc54ddee",
"TLSPath": "C:\\Users\\simon\\.docker\\contexts\\tls\\cb6d08c0a1bfa5fe6f012e61a442788c00bed93f509141daff05f620fc54ddee"
}
{
"Name": "local+aks",
"Metadata": {
"Description": "Local Docker Engine + Azure AKS endpoint",
"StackOrchestrator": "kubernetes"
},
"Endpoints": {
"docker": {
"Host": "npipe:////./pipe/docker_engine",
"SkipTLSVerify": false
},
"kubernetes": {
"Host": "https://simon-aks-***.hcp.uksouth.azmk8s.io:443",
"SkipTLSVerify": false,
"DefaultNamespace": "default"
}
},
"TLSMaterial": {
"kubernetes": [
"ca.pem",
"cert.pem",
"key.pem"
]
},
"Storage": {
"MetadataPath": "C:\\Users\\simon\\.docker\\contexts\\meta\\cb6d08c0a1bfa5fe6f012e61a442788c00bed93f509141daff05f620fc54ddee",
"TLSPath": "C:\\Users\\simon\\.docker\\contexts\\tls\\cb6d08c0a1bfa5fe6f012e61a442788c00bed93f509141daff05f620fc54ddee"
}
}
]
```
deprecated: false

View File

@ -24,6 +24,16 @@ options:
experimentalcli: false
kubernetes: false
swarm: false
examples: |-
Use `docker context ls` to print all contexts. The currently active context is
indicated with an `*`:
```bash
NAME DESCRIPTION DOCKER ENDPOINT KUBERNETES ENDPOINT ORCHESTRATOR
default * Current DOCKER_HOST based configuration unix:///var/run/docker.sock swarm
production tcp:///prod.corp.example.com:2376
staging tcp:///stage.corp.example.com:2376
```
deprecated: false
experimental: false
experimentalcli: false

View File

@ -2,7 +2,7 @@ command: docker context update
short: Update a context
long: |-
Updates an existing `context`.
See [context create](context_create.md)
See [context create](context_create.md).
usage: docker context update [OPTIONS] CONTEXT
pname: docker context
plink: docker_context.yaml
@ -42,6 +42,15 @@ options:
experimentalcli: false
kubernetes: false
swarm: false
examples: |-
### Update an existing context
```bash
$ docker context update \
--description "some description" \
--docker "host=tcp://myserver:2376,ca=~/ca-file,cert=~/cert-file,key=~/key-file" \
my-context
```
deprecated: false
experimental: false
experimentalcli: false

View File

@ -1,7 +1,8 @@
command: docker context use
short: Set the current docker context
long: |-
Set the default context to use, when `DOCKER_HOST`, `DOCKER_CONTEXT` environment variables and `--host`, `--context` global options are not set.
Set the default context to use, when `DOCKER_HOST`, `DOCKER_CONTEXT` environment
variables and `--host`, `--context` global options are not set.
To disable usage of contexts, you can use the special `default` context.
usage: docker context use CONTEXT
pname: docker context

View File

@ -237,7 +237,7 @@ examples: |-
**Shell 1: (Again .. now showing events):**
```none
```console
2017-01-05T00:35:58.859401177+08:00 container create 0fdb48addc82871eb34eb23a847cfd033dedd1a0a37bef2e6d9eb3870fc7ff37 (image=alpine:latest, name=test)
2017-01-05T00:36:04.703631903+08:00 network connect e2e1f5ceda09d4300f3a846f0acfaa9a8bb0d89e775eb744c5acecd60e0529e2 (container=0fdb...ff37, name=bridge, type=bridge)
2017-01-05T00:36:04.795031609+08:00 container start 0fdb...ff37 (image=alpine:latest, name=test)

View File

@ -82,7 +82,7 @@ examples: |-
### Import from a local directory with new configurations
```bash
$ sudo tar -c . | docker import --change "ENV DEBUG true" - exampleimagedir
$ sudo tar -c . | docker import --change "ENV DEBUG=true" - exampleimagedir
```
Note the `sudo` in this example you must preserve

View File

@ -196,7 +196,7 @@ examples: |-
Here is a sample output for a daemon running on Windows Server 2016:
```none
```console
E:\docker>docker info
Client:
Debug Mode: false

View File

@ -108,7 +108,7 @@ examples: |-
$ docker run --name test -d busybox sh -c "while true; do $(echo date); sleep 1; done"
$ date
Tue 14 Nov 2017 16:40:00 CET
$ docker logs -f --until=2s
$ docker logs -f --until=2s test
Tue 14 Nov 2017 16:40:00 CET
Tue 14 Nov 2017 16:40:01 CET
Tue 14 Nov 2017 16:40:02 CET

View File

@ -66,7 +66,7 @@ examples: |-
The following removes networks created more than 5 minutes ago. Note that
system networks such as `bridge`, `host`, and `none` will never be pruned:
```none
```bash
$ docker network ls
NETWORK ID NAME DRIVER SCOPE

View File

@ -33,8 +33,8 @@ examples: |-
$ docker plugin ls
ID NAME TAG DESCRIPTION ENABLED
672d8144ec02 plugin latest A sample plugin for Docker false
ID NAME DESCRIPTION ENABLED
672d8144ec02 plugin:latest A sample plugin for Docker false
```
The plugin can subsequently be enabled for local use or pushed to the public registry.

View File

@ -25,8 +25,8 @@ examples: |-
```bash
$ docker plugin ls
ID NAME TAG DESCRIPTION ENABLED
69553ca1d123 tiborvass/sample-volume-plugin latest A test plugin for Docker true
ID NAME DESCRIPTION ENABLED
69553ca1d123 tiborvass/sample-volume-plugin:latest A test plugin for Docker true
```
To disable the plugin, use the following command:
@ -38,8 +38,8 @@ examples: |-
$ docker plugin ls
ID NAME TAG DESCRIPTION ENABLED
69553ca1d123 tiborvass/sample-volume-plugin latest A test plugin for Docker false
ID NAME DESCRIPTION ENABLED
69553ca1d123 tiborvass/sample-volume-plugin:latest A test plugin for Docker false
```
deprecated: false
min_api_version: "1.25"

View File

@ -23,8 +23,8 @@ examples: |-
```bash
$ docker plugin ls
ID NAME TAG DESCRIPTION ENABLED
69553ca1d123 tiborvass/sample-volume-plugin latest A test plugin for Docker false
ID NAME DESCRIPTION ENABLED
69553ca1d123 tiborvass/sample-volume-plugin:latest A test plugin for Docker false
```
To enable the plugin, use the following command:
@ -36,8 +36,8 @@ examples: |-
$ docker plugin ls
ID NAME TAG DESCRIPTION ENABLED
69553ca1d123 tiborvass/sample-volume-plugin latest A test plugin for Docker true
ID NAME DESCRIPTION ENABLED
69553ca1d123 tiborvass/sample-volume-plugin:latest A test plugin for Docker true
```
deprecated: false
min_api_version: "1.25"

View File

@ -66,8 +66,8 @@ examples: |-
```bash
$ docker plugin ls
ID NAME TAG DESCRIPTION ENABLED
69553ca1d123 vieux/sshfs latest sshFS plugin for Docker true
ID NAME DESCRIPTION ENABLED
69553ca1d123 vieux/sshfs:latest sshFS plugin for Docker true
```
deprecated: false
min_api_version: "1.25"

View File

@ -50,8 +50,8 @@ examples: |-
```bash
$ docker plugin ls
ID NAME TAG DESCRIPTION ENABLED
69553ca1d123 tiborvass/sample-volume-plugin latest A test plugin for Docker true
ID NAME DESCRIPTION ENABLED
69553ca1d123 tiborvass/sample-volume-plugin:latest A test plugin for Docker true
```
### Filtering
@ -81,7 +81,7 @@ examples: |-
$ docker plugin ls --filter enabled=true
NAME TAG DESCRIPTION ENABLED
ID NAME DESCRIPTION ENABLED
```
### Formatting
@ -94,7 +94,7 @@ examples: |-
Placeholder | Description
-------------------|------------------------------------------------------------
`.ID` | Plugin ID
`.Name` | Plugin name
`.Name` | Plugin name and tag
`.Description` | Plugin description
`.Enabled` | Whether plugin is enabled or not
`.PluginReference` | The reference used to push/pull from a registry

View File

@ -25,8 +25,8 @@ examples: |-
```bash
$ docker plugin ls
ID NAME TAG DESCRIPTION ENABLED
69553ca1d456 user/plugin latest A sample plugin for Docker false
ID NAME DESCRIPTION ENABLED
69553ca1d456 user/plugin:latest A sample plugin for Docker false
$ docker plugin push user/plugin
```

View File

@ -215,7 +215,7 @@ examples: |-
You can use a filter to locate containers that exited with status of `137`
meaning a `SIGKILL(9)` killed them.
```none
```bash
$ docker ps -a --filter 'exited=137'
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

View File

@ -1180,7 +1180,7 @@ examples: |-
running inside a container.) The following example illustrates a label-file
format:
```none
```console
com.example.label1="a label"
# this is a comment

View File

@ -64,7 +64,7 @@ examples: |-
This example displays images with a name containing 'busybox':
```none
```bash
$ docker search busybox
NAME DESCRIPTION STARS OFFICIAL AUTOMATED

View File

@ -80,7 +80,7 @@ examples: |-
eo7jnzguqgtpdah3cm5srfb97
```
```none
```bash
$ docker secret inspect my_secret
[

View File

@ -53,25 +53,29 @@ examples: |-
eo7jnzguqgtpdah3cm5srfb97 my_secret 3 minutes ago 3 minutes ago
```
```none
```bash
$ docker secret inspect secret.json
```
The output is in JSON format, for example:
```json
[
{
"ID": "eo7jnzguqgtpdah3cm5srfb97",
"Version": {
"Index": 17
},
"CreatedAt": "2017-03-24T08:15:09.735271783Z",
"UpdatedAt": "2017-03-24T08:15:09.735271783Z",
"Spec": {
"Name": "my_secret",
"Labels": {
"env": "dev",
"rev": "20170324"
}
}
{
"ID": "eo7jnzguqgtpdah3cm5srfb97",
"Version": {
"Index": 17
},
"CreatedAt": "2017-03-24T08:15:09.735271783Z",
"UpdatedAt": "2017-03-24T08:15:09.735271783Z",
"Spec": {
"Name": "my_secret",
"Labels": {
"env": "dev",
"rev": "20170324"
}
}
}
]
```

View File

@ -55,7 +55,11 @@ examples: |-
```bash
$ docker service inspect redis
```
The output is in JSON format, for example:
```json
[
{
"ID": "dmu1ept4cxcfe8k8lhtux3ro3",

View File

@ -151,7 +151,7 @@ examples: |-
#### desired-state
The `desired-state` filter can take the values `running`, `shutdown`, or `accepted`.
The `desired-state` filter can take the values `running`, `shutdown`, `ready` or `accepted`.
```bash
$ docker stack ps -f "desired-state=running" voting

View File

@ -25,6 +25,11 @@ examples: |-
```bash
$ docker trust inspect alpine:latest
```
The output is in JSON format, for example:
```json
[
{
"Name": "alpine:latest",
@ -70,6 +75,11 @@ examples: |-
```bash
$ docker trust inspect my-image:purple
```
The output is in JSON format, for example:
```json
[
{
"Name": "my-image:purple",
@ -152,7 +162,11 @@ examples: |-
```bash
$ docker trust inspect alpine:unsigned
```
The output is in JSON format, for example:
```json
[
{
"Name": "alpine:unsigned",
@ -186,7 +200,11 @@ examples: |-
```bash
$ docker trust inspect alpine
```
The output is in JSON format, for example:
```json
[
{
"Name": "alpine",
@ -251,7 +269,11 @@ examples: |-
```bash
$ docker trust inspect alpine notary
```
The output is in JSON format, for example:
```json
[
{
"Name": "alpine",

View File

@ -65,7 +65,7 @@ examples: |-
volume name with two different drivers. If you attempt this `docker` returns an
error:
```none
```console
A volume named "hello" already exists with the "some-other" driver. Choose a different volume name.
```

View File

@ -21,27 +21,39 @@ options:
swarm: false
examples: |-
```bash
$ docker volume create
$ docker volume create myvolume
8140a838303144125b4f54653b47ede0486282c623c3551fbc7f390cdc3e9cf5
myvolume
```
$ docker volume inspect 85bffb0677236974f93955d8ecc4df55ef5070117b0e53333cc1b443777be24d
Use the `docker volume inspect` comment to inspect the configuration of the volume:
```bash
$ docker volume inspect myvolume
```
The output is in JSON format, for example:
```json
[
{
"CreatedAt": "2020-04-19T11:00:21Z",
"Driver": "local",
"Labels": {},
"Mountpoint": "/var/lib/docker/volumes/8140a838303144125b4f54653b47ede0486282c623c3551fbc7f390cdc3e9cf5/_data",
"Name": "8140a838303144125b4f54653b47ede0486282c623c3551fbc7f390cdc3e9cf5",
"Name": "myvolume",
"Options": {},
"Scope": "local"
}
]
```
Use the `--format` flag to format the output using a Go template, for example,
to print the `Mountpoint` property:
$ docker volume inspect --format '{{ .Mountpoint }}' 8140a838303144125b4f54653b47ede0486282c623c3551fbc7f390cdc3e9cf5
```bash
$ docker volume inspect --format '{{ .Mountpoint }}' myvolume
/var/lib/docker/volumes/8140a838303144125b4f54653b47ede0486282c623c3551fbc7f390cdc3e9cf5/_data
/var/lib/docker/volumes/myvolume/_data
```
deprecated: false
min_api_version: "1.21"