Files
cheatsheet-tldr/tldr/docker-context
2025-12-03 12:55:58 +00:00

26 lines
611 B
Plaintext

---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# 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:
`docker context create {{context_name}} --docker "host={{tcp://remote-host:2375}}"`
- Create a context based on the `$DOCKER_HOST` environment variable:
`docker context create {{context_name}}`
- Switch to a context:
`docker context use {{context_name}}`
- List all contexts:
`docker context ls`