HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

docker context — Switch between contexts to manage multiple Docker environments. More information: <https://docs.dock

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commandbetweenmultiplecontextsclimanagedocker contextswitch

Problem

How to use the docker context command: Switch between contexts to manage multiple Docker environments. More information: <https://docs.docker.com/reference/cli/docker/context/>.

Solution

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

Code Snippets

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

Context

tldr-pages: common/docker context

Revisions (0)

No revisions yet.