I like having the Docker CLI on my laptop and the containers on a server. Contexts make that work without a log-in dance each time.
docker context create remote --docker "host=ssh://[email protected]"
docker context use remote
docker ps
docker context use default
The first line stores the endpoint of the remote Docker engine under the name remote. After docker context use remote, every docker command goes to that machine through SSH, until you switch back with docker context use default. For a single command, docker --context remote ps does it without switching.
Docker’s own documentation shows this form for protecting the daemon socket, and also mentions the DOCKER_HOST variable as the alternative for one-off connections. A host name from your ~/.ssh/config works in the URL, so your keys and jump hosts apply.
The caveat is access. The SSH login must work without a password prompt, normally with a key, and the remote user needs the right to talk to the Docker daemon. That is effectively root access on the server, so treat the key accordingly. A forgotten active context is another trap: docker context ls marks the current one, so check it before running something like a prune on what you think is your laptop.
Further reading: Docker docs: protect the Docker daemon socket, docker context