Docker: Connecting to a Remote Host
I for one, maybe not everyone, but I for a long time though that to be able to communicate with a docker instance I had to be on that box.
First, after digging around I found the DOCKER_HOST environment variable, which served it purpose, and allowed me to connect to one or more of my docker hosts;
$ export DOCKER_HOST="ssh://me@dockerhost
$ docker ps
CONTAINER ID IMAGE...
Now after (unsuccessly) having looked at VS Code and it's Docker extension (which as of writing is broken in more than one way), I discovered Docker Contexts.
Instead of using DOCKER_HOST one should use docker contexts, which allow to setup multiple hosts to connect to.
$ docker context ls
NAME TYPE DESCRIPTION
default moby Current DOCKER_HOST based
dockerhost * moby
Setting up a new context is quite easy:
context create <contextname> --docker
To switch between Docker contexts is also quite easy:
$ docker context use <contextname>
Docker is not always easy, until you run into the right explanation.