Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit 38cd618

Browse files
Merge pull request #2509 from thaJeztah/19.03_backport_docs_fixes
[19.03 backport] documentation fixes Upstream-commit: 052a71c4d0655c666ecf8f35d3476c2aedea1de4 Component: cli
2 parents 50d22f0 + 3e7fc6b commit 38cd618

9 files changed

Lines changed: 96 additions & 51 deletions

File tree

components/cli/docs/reference/builder.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,7 @@ flag, for example `docker build --no-cache`.
743743
See the [`Dockerfile` Best Practices
744744
guide](https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/) for more information.
745745
746-
The cache for `RUN` instructions can be invalidated by `ADD` instructions. See
747-
[below](#add) for details.
746+
The cache for `RUN` instructions can be invalidated by [`ADD`](#add) and [`COPY`](#copy) instructions.
748747
749748
### Known issues (RUN)
750749
@@ -1114,7 +1113,7 @@ does not support authentication.
11141113
> following instructions from the Dockerfile if the contents of `<src>` have
11151114
> changed. This includes invalidating the cache for `RUN` instructions.
11161115
> See the [`Dockerfile` Best Practices
1117-
guide](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/)
1116+
guide – Leverage build cache](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#leverage-build-cache)
11181117
> for more information.
11191118
11201119
@@ -1303,6 +1302,15 @@ image with the same name is attempted to be used instead.
13031302
13041303
- If `<dest>` doesn't exist, it is created along with all missing directories
13051304
in its path.
1305+
1306+
> **Note**
1307+
>
1308+
> The first encountered `COPY` instruction will invalidate the cache for all
1309+
> following instructions from the Dockerfile if the contents of `<src>` have
1310+
> changed. This includes invalidating the cache for `RUN` instructions.
1311+
> See the [`Dockerfile` Best Practices
1312+
guide – Leverage build cache](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#leverage-build-cache)
1313+
> for more information.
13061314
13071315
## ENTRYPOINT
13081316

components/cli/docs/reference/commandline/context_create.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,30 @@ Options:
5353
Creates a new `context`. This allows you to quickly switch the cli
5454
configuration to connect to different clusters or single nodes.
5555

56+
## Examples
57+
58+
### Create a context with a docker and kubernetes endpoint
59+
5660
To create a context from scratch provide the docker and, if required,
5761
kubernetes options. The example below creates the context `my-context`
5862
with a docker endpoint of `/var/run/docker.sock` and a kubernetes configuration
5963
sourced from the file `/home/me/my-kube-config`:
6064

6165
```bash
62-
$ docker context create my-context \
63-
--docker host=/var/run/docker.sock \
64-
--kubernetes config-file=/home/me/my-kube-config
66+
$ docker context create \
67+
--docker host=unix:///var/run/docker.sock \
68+
--kubernetes config-file=/home/me/my-kube-config \
69+
my-context
6570
```
6671

72+
### Create a context based on an existing context
73+
6774
Use the `--from=<context-name>` option to create a new context from
6875
an existing context. The example below creates a new context named `my-context`
6976
from the existing context `existing-context`:
7077

7178
```bash
72-
$ docker context create my-context --from existing-context
79+
$ docker context create --from existing-context my-context
7380
```
7481

7582
If the `--from` option is not set, the `context` is created from the current context:
@@ -92,9 +99,10 @@ the existing context `existing-context` and a kubernetes configuration sourced
9299
from the file `/home/me/my-kube-config`:
93100

94101
```bash
95-
$ docker context create my-context \
96-
--docker from=existing-context \
97-
--kubernetes config-file=/home/me/my-kube-config
102+
$ docker context create \
103+
--docker from=existing-context \
104+
--kubernetes config-file=/home/me/my-kube-config \
105+
my-context
98106
```
99107

100108
To source only the `kubernetes` configuration from an existing context use the
@@ -103,10 +111,13 @@ context named `my-context` using the kuberentes configuration from the existing
103111
context `existing-context` and a docker endpoint of `/var/run/docker.sock`:
104112

105113
```bash
106-
$ docker context create my-context \
107-
--docker host=/var/run/docker.sock \
108-
--kubernetes from=existing-context
114+
$ docker context create \
115+
--docker host=unix:///var/run/docker.sock \
116+
--kubernetes from=existing-context \
117+
my-context
109118
```
110119

111120
Docker and Kubernetes endpoints configurations, as well as default stack
112-
orchestrator and description can be modified with `docker context update`
121+
orchestrator and description can be modified with `docker context update`.
122+
123+
Refer to the [`docker context update` reference](context_update.md) for details.

components/cli/docs/reference/commandline/context_export.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Options:
1717

1818
## Description
1919

20-
Exports a context in a file that can then be used with `docker context import` (or with `kubectl` if `--kubeconfig` is set).
21-
Default output filename is `<CONTEXT>.dockercontext`, or `<CONTEXT>.kubeconfig` if `--kubeconfig` is set.
20+
Exports a context in a file that can then be used with `docker context import`
21+
(or with `kubectl` if `--kubeconfig` is set). Default output filename is
22+
`<CONTEXT>.dockercontext`, or `<CONTEXT>.kubeconfig` if `--kubeconfig` is set.
2223
To export to `STDOUT`, you can run `docker context export my-context -`.

components/cli/docs/reference/commandline/context_import.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ Import a context from a tar file
1414

1515
## Description
1616

17-
Imports a context previously exported with `docker context export`. To import from stdin, use a hyphen (`-`) as filename.
17+
Imports a context previously exported with `docker context export`. To import
18+
from stdin, use a hyphen (`-`) as filename.

components/cli/docs/reference/commandline/context_inspect.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -27,34 +27,34 @@ Inspects one or more contexts.
2727
$ docker context inspect "local+aks"
2828

2929
[
30-
{
31-
"Name": "local+aks",
32-
"Metadata": {
33-
"Description": "Local Docker Engine + Azure AKS endpoint",
34-
"StackOrchestrator": "kubernetes"
35-
},
36-
"Endpoints": {
37-
"docker": {
38-
"Host": "npipe:////./pipe/docker_engine",
39-
"SkipTLSVerify": false
40-
},
41-
"kubernetes": {
42-
"Host": "https://simon-aks-***.hcp.uksouth.azmk8s.io:443",
43-
"SkipTLSVerify": false,
44-
"DefaultNamespace": "default"
45-
}
46-
},
47-
"TLSMaterial": {
48-
"kubernetes": [
49-
"ca.pem",
50-
"cert.pem",
51-
"key.pem"
52-
]
53-
},
54-
"Storage": {
55-
"MetadataPath": "C:\\Users\\simon\\.docker\\contexts\\meta\\cb6d08c0a1bfa5fe6f012e61a442788c00bed93f509141daff05f620fc54ddee",
56-
"TLSPath": "C:\\Users\\simon\\.docker\\contexts\\tls\\cb6d08c0a1bfa5fe6f012e61a442788c00bed93f509141daff05f620fc54ddee"
57-
}
30+
{
31+
"Name": "local+aks",
32+
"Metadata": {
33+
"Description": "Local Docker Engine + Azure AKS endpoint",
34+
"StackOrchestrator": "kubernetes"
35+
},
36+
"Endpoints": {
37+
"docker": {
38+
"Host": "npipe:////./pipe/docker_engine",
39+
"SkipTLSVerify": false
40+
},
41+
"kubernetes": {
42+
"Host": "https://simon-aks-***.hcp.uksouth.azmk8s.io:443",
43+
"SkipTLSVerify": false,
44+
"DefaultNamespace": "default"
45+
}
46+
},
47+
"TLSMaterial": {
48+
"kubernetes": [
49+
"ca.pem",
50+
"cert.pem",
51+
"key.pem"
52+
]
53+
},
54+
"Storage": {
55+
"MetadataPath": "C:\\Users\\simon\\.docker\\contexts\\meta\\cb6d08c0a1bfa5fe6f012e61a442788c00bed93f509141daff05f620fc54ddee",
56+
"TLSPath": "C:\\Users\\simon\\.docker\\contexts\\tls\\cb6d08c0a1bfa5fe6f012e61a442788c00bed93f509141daff05f620fc54ddee"
5857
}
58+
}
5959
]
60-
```
60+
```

components/cli/docs/reference/commandline/context_ls.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,16 @@ Options:
1818
--format string Pretty-print contexts using a Go template
1919
(default "table")
2020
-q, --quiet Only show context names
21-
```
21+
```
22+
23+
## Examples
24+
25+
Use `docker context ls` to print all contexts. The currently active context is
26+
indicated with an `*`:
27+
28+
```bash
29+
NAME DESCRIPTION DOCKER ENDPOINT KUBERNETES ENDPOINT ORCHESTRATOR
30+
default * Current DOCKER_HOST based configuration unix:///var/run/docker.sock swarm
31+
production tcp:///prod.corp.example.com:2376
32+
staging tcp:///stage.corp.example.com:2376
33+
```

components/cli/docs/reference/commandline/context_rm.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ Aliases:
1616

1717
Options:
1818
-f, --force Force the removal of a context in use
19-
```
19+
```

components/cli/docs/reference/commandline/context_update.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,15 @@ Options:
4848
## Description
4949

5050
Updates an existing `context`.
51-
See [context create](context_create.md)
51+
See [context create](context_create.md).
52+
53+
## Examples
54+
55+
### Update an existing context
56+
57+
```bash
58+
$ docker context update \
59+
--description "some description" \
60+
--docker "host=tcp://myserver:2376,ca=~/ca-file,cert=~/cert-file,key=~/key-file" \
61+
my-context
62+
```

components/cli/docs/reference/commandline/context_use.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ Set the current docker context
1313
```
1414

1515
## Description
16-
Set the default context to use, when `DOCKER_HOST`, `DOCKER_CONTEXT` environment variables and `--host`, `--context` global options are not set.
17-
To disable usage of contexts, you can use the special `default` context.
16+
Set the default context to use, when `DOCKER_HOST`, `DOCKER_CONTEXT` environment
17+
variables and `--host`, `--context` global options are not set.
18+
To disable usage of contexts, you can use the special `default` context.

0 commit comments

Comments
 (0)