This is a cheatsheet for working with docker context to connect remote docker locally. Might help you to work with remote docker without manually SSH to the remote server.
$ docker context use my-remote-docker-machine
my-remote-docker-machine
Current context is now "my-remote-docker-machine"$ docker context ls
NAME DESCRIPTION DOCKER ENDPOINT KUBERNETES ENDPOINT ORCHESTRATOR
default Current DOCKER_HOST based configuration unix:///var/run/docker.sock swarm
my-remote-docker-machine * ssh://[email protected]
See the * is moved from default to my-remote-docker-machine. Now you can use your docker command without --context flag.
Remove Context
1
2
3
$ docker context use default # back to default$ docker context rm my-remote-docker-machine
my-remote-docker-machine
Conclusion
Using docker context might help to avoid SSH manually to the remote server. But, when it comes to build an image using a remote docker locally, you need to consider how much docker context that will be uploaded/downloaded.
Thank you for reading!
···
Love This Content?
Any kind of supports is greatly appreciated! Kindly support me via Bitcoin, Ko-fi, Trakteer, or just continue to read another content. You can write a response via Webmention and let me know the URL via Telegraph.