2025-03-14 21:59:59 -06:00
|
|
|
# docker context
|
|
|
|
|
|
|
|
|
|
> Switch between contexts to manage multiple Docker environments.
|
|
|
|
|
> More information: <https://docs.docker.com/reference/cli/docker/context/>.
|
|
|
|
|
|
|
|
|
|
- Create a context using a specific Docker endpoint:
|
|
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
`docker context create {{context_name}} --docker "host={{tcp://remote-host:2375}}"`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
- Create a context based on the `$DOCKER_HOST` environment variable:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
`docker context create {{context_name}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Switch to a context:
|
|
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
`docker context use {{context_name}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- List all contexts:
|
|
|
|
|
|
|
|
|
|
`docker context ls`
|