-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Expand file tree
/
Copy pathdocker_context_use.yaml
More file actions
75 lines (59 loc) · 1.78 KB
/
Copy pathdocker_context_use.yaml
File metadata and controls
75 lines (59 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
command: docker context use
short: Set the default docker context
long: |-
The `docker context use` command sets the default context for the Docker CLI.
The `docker context use` command sets the Docker CLI’s default context by updating
your CLI config (`~/.docker/config.json`). This change is persistent, affecting
all shells and sessions that share that config, not just the current terminal.
For one-off commands or per-shell usage, use `--context` or the `DOCKER_CONTEXT`
environment variable instead.
usage: docker context use CONTEXT
pname: docker context
plink: docker_context.yaml
inherited_options:
- option: help
value_type: bool
default_value: "false"
description: Print usage
deprecated: false
hidden: true
experimental: false
experimentalcli: false
kubernetes: false
swarm: false
examples: |-
### Set the default (sticky) context
This updates the CLI configuration and applies to new terminal sessions:
```bash
$ docker context use my-context
my-context
$ docker context show
my-context
```
### Use a context for a single command
Use the global `--context` flag to avoid changing the default:
```bash
$ docker --context my-context ps
```
### Use a context for the current shell session
Set `DOCKER_CONTEXT` to override the configured default in the current shell:
```bash
$ export DOCKER_CONTEXT=my-context
$ docker context show
my-context
```
To stop overriding:
```bash
$ unset DOCKER_CONTEXT
```
### Switch back to the default context
```bash
$ docker context use default
default
```
deprecated: false
hidden: false
experimental: false
experimentalcli: false
kubernetes: false
swarm: false