Check if the latest docker 18.09 includes that feature.
See docker/cli PR 1014

Added support for SSH connection. e.g. docker -H ssh://me@server

  • The cli should accept ssh://me@server for DOCKER_HOST and -H. Using that would execute ssh with the passed config.
  • The ssh command would call a hidden command on the docker CLI binary on the remote side. For example, docker dial-stdio.

This command will make a connection to the local DOCKER_HOST variable (almost always the default local socket) and forward that connection on the commands stdio.
Even though this command is supposed to run locally to the dockerd binary, we think that it is an invalid configuration for this feature to remove the local docker binary so we can rely on it always being present.

How to verify it

docker -H ssh://me@server run -it --rm busybox

The reaction so far:

From ops and sysadmins everywhere, we thank you for this fantastic and unexpected feature.
I'm hoping this will seriously cut down the number of times I see people opening dockerd TCP w/o TLS and just opt for SSH endpoints for remote mgmt.

Answer from VonC on Stack Overflow
🌐
Docker Docs
docs.docker.com › manuals › docker engine › daemon › configure remote access for docker daemon
Configure remote access for Docker daemon | Docker Docs
Configuring remote access allows Docker to accept requests from remote hosts by configuring it to listen on an IP address and port as well as the Unix socket
🌐
Reddit
reddit.com › r/docker › is it possible to configure docker to use a remote host for everything?
r/docker on Reddit: Is it possible to configure Docker to use a remote host for everything?
December 12, 2024 -

Here is my scenario. I have a Windows 10 professional deployment running as a guest under KVM. The performance of the Windows guest is sufficient. However, I need to use docker under Windows (work thing, no options here) and even though I can get it to work via configuring the KVM, the performance is no longer acceptable.

If I could somehow use the docker commands so that they would perform all the actions on a remote host, it would be great, because then I could use the KVM host to run docker, and use docker from within the Windows guest. I know it is possible to configure access to docker by exposing a TCP port etc but what I don't know is if stuff like port forwarding could work if I configured a remote docker host.

There's also the issue about mounting disk volumes. I can probably get away by using docker volumes to replace that, but that's not the same as just mounting a directory, which is what devcontainers do for example.

I realise I am really pushing for a convoluted configuration here, so please take the question as more of an intellectual exercise than something I insist on doing.

Discussions

Connect to remote docker host
How can I connect my local docker client to a remote docker host on my network? I have a ubuntu server box on my local network on which I intend to setup my containers. However, at this point, I have to SSH into that box from my development box manually and then run the containers. More on forums.docker.com
🌐 forums.docker.com
4
0
May 24, 2016
linux - `docker run` on a remote host - Stack Overflow
is it possible (using the docker command or the docker-py API directly) to start a container from a remote host? Lets assume I have two machines that have different architectures: - A is an x86 ma... More on stackoverflow.com
🌐 stackoverflow.com
Deploying to remote Docker Instance - Waypoint - HashiCorp Discuss
Hi there, I’ve started playing with Waypoint and really enjoying it so far. I was just curious about deploying my containerized app to a remote docker daemon? I’m running a Docker Swarm in some VMs and would like to use Waypoint to deploy to that cluster instead of the local Docker daemon. More on discuss.hashicorp.com
🌐 discuss.hashicorp.com
0
October 16, 2020
Docker command execution on remote host extremly slow on Windows 10
Hey, I added a remote Docker context over ssh to my Windows 10 installation of Docker but executing any kind of command that has to contact the remote server takes at least 30 ish seconds before getting any kind of response. λ docker container ls ~ took 33s and λ docker info ~ took 34s λ ... More on forums.docker.com
🌐 forums.docker.com
3
2
November 2, 2023
🌐
Visual Studio Code
code.visualstudio.com › remote › advancedcontainers › develop-remote-host
Develop on a remote Docker host
November 3, 2021 - Docker does not support mounting (binding) your local filesystem into a remote dev container, so Visual Studio Code's default devcontainer.json behavior to use your local source code will not work.
🌐
Docker
docker.com › blog › how-to-deploy-on-remote-docker-hosts-with-docker-compose
How to deploy on remote Docker hosts with docker-compose | Docker
April 23, 2021 - As developers look to have the same ease-of-deployment in CI pipelines/production environments as in their development environment, we find today docker-compose being used in different ways and beyond its initial scope. In such cases, the challenge is that docker-compose provided support for running on remote docker engines through the use of the DOCKER_HOST environment variable and -H, –host command line option.
🌐
Joelsleppy
joelsleppy.com › blog › remote-docker-host
Cool Things About Remote Docker Hosts
July 9, 2025 - $ DOCKER_HOST=ssh://root@174.138.83.113 docker info Client: Docker Engine - Community Version: 28.3.1 # ... Server: Containers: 0 Running: 0 Paused: 0 Stopped: 0 Images: 0 Server Version: 28.3.2 # ... Wonderful. And now every Docker command works, but it runs on that remote server:
🌐
Medium
medium.com › @leroyleowdev › enabling-remote-access-to-the-docker-daemon-6303d69d99b4
Enabling Remote Access to the Docker Daemon | by Leroy Leow | Medium
September 17, 2024 - Configure the Docker CLI on your local machine to communicate with the remote Docker daemon by setting the DOCKER_HOST environment variable.
Find elsewhere
🌐
GitHub
gist.github.com › prom3theu5 › b8e5cbd703783efd2a1be98e67e84eda
Connect to another host with your docker client, without modifying your local Docker installation · GitHub
# Linux/Mac unset DOCKER_HOST unset DOCKER_TLS_VERIFY unset DOCKER_CERT_PATH # Windows Powershell Remove-Item env:DOCKER_HOST Remove-Item env:DOCKER_TLS_VERIFY Remove-Item env:DOCKER_CERT_PATH · If you already added an SSH public key to your remote server, then you can use this ssh credentials for your docker connection, too.
🌐
Pchudzik
blog.pchudzik.com › 202209 › remote-docker
How to setup remote docker host
September 26, 2022 - Configure testcontainers to use remote docker daemon · Open ~/.testcontainers.properties and put following content into it (modify docker-host to be your docker daemon address):
🌐
Docker Community
forums.docker.com › general
Connect to remote docker host - General - Docker Community Forums
May 24, 2016 - How can I connect my local docker client to a remote docker host on my network? I have a ubuntu server box on my local network on which I intend to setup my containers. However, at this point, I have to SSH into that b…
Top answer
1 of 4
44

Check if the latest docker 18.09 includes that feature.
See docker/cli PR 1014

Added support for SSH connection. e.g. docker -H ssh://me@server

  • The cli should accept ssh://me@server for DOCKER_HOST and -H. Using that would execute ssh with the passed config.
  • The ssh command would call a hidden command on the docker CLI binary on the remote side. For example, docker dial-stdio.

This command will make a connection to the local DOCKER_HOST variable (almost always the default local socket) and forward that connection on the commands stdio.
Even though this command is supposed to run locally to the dockerd binary, we think that it is an invalid configuration for this feature to remove the local docker binary so we can rely on it always being present.

How to verify it

docker -H ssh://me@server run -it --rm busybox

The reaction so far:

From ops and sysadmins everywhere, we thank you for this fantastic and unexpected feature.
I'm hoping this will seriously cut down the number of times I see people opening dockerd TCP w/o TLS and just opt for SSH endpoints for remote mgmt.

2 of 4
8

If your targeted machine B could be created on one of these platform then, I guess, docker-machine would serve your needs.

You would create your machine using docker-machine create --driver <..driver setup..> MACHINE_B then you activate it using eval $(docker-machine env MACHINE_B).

docker-machine env MACHINE_B will print out some export statements:

export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://...."
export DOCKER_CERT_PATH="/..."
export DOCKER_MACHINE_NAME="MACHINE_B"

Once your machine is active, you can use the docker command as you would locally to act remotely on MACHINE_B.

🌐
Programster
blog.programster.org › use-remote-docker-host-with-ssh
Use Remote Docker Host With SSH | Programster's Blog
August 25, 2022 - This tutorial will show you how you can configure Docker to safely use a remote Docker host, by simply configuring SSH details, rather than having to set up any kind of fancy TLS security.
🌐
Microsoft Learn
learn.microsoft.com › en-us › virtualization › windowscontainers › manage-docker › manage-remote-host
Remote management of a Windows Docker host | Microsoft Learn
January 27, 2025 - Even in the absence of docker-machine one can still create a remotely accessible Docker Host on a Windows Server VM.
🌐
Dozzle
dozzle.dev › guide › remote-hosts
Remote Host Setup | Dozzle
December 11, 2025 - You need to have at least one remote host to connect to. ... Docker Socket Proxy exposes the Docker API to the internet.
🌐
Atlantic.Net
atlantic.net › home › blog › how to set up remote access to docker daemon
How to Set Up Remote Access to Docker Daemon | Atlantic.Net
November 18, 2023 - If you are a system administrator ... This is where Docker daemon comes into the picture. Docker daemon allows you to connect to a remote docker host over TCP....
🌐
HashiCorp Discuss
discuss.hashicorp.com › waypoint
Deploying to remote Docker Instance - Waypoint - HashiCorp Discuss
October 16, 2020 - Hi there, I’ve started playing with Waypoint and really enjoying it so far. I was just curious about deploying my containerized app to a remote docker daemon? I’m running a Docker Swarm in some VMs and would like to use …
🌐
RustDesk
rustdesk.com › rustdesk documentation - open source remote desktop › self-host › rustdesk server oss › docker
Docker – RustDesk Documentation
3 weeks ago - Start hbbs and hbbr with Docker Compose, docker run, or Podman Quadlet. Point clients to the new self-hosted server and verify registration and relay traffic. Here is another good tutorial: Building Your Own Remote Desktop Solution: RustDesk Self-Hosted on Cloud with Docker (Hetzner)
🌐
How-To Geek
howtogeek.com › home › programming › how and why to use a remote docker host
How and Why to Use A Remote Docker Host
May 20, 2021 - The Docker CLI uses the DOCKER_HOST ... isn't set. You can use a remote host for a single docker command by prepending the DOCKER_HOST variable:...
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-use-a-remote-docker-server-to-speed-up-your-workflow
How to Use a Remote Docker Server to Speed Up Your Workflow | DigitalOcean
June 25, 2019 - Now that the server is ready, let’s configure the local docker command to use it. To use the remote host as your Docker host instead of your local machine, set the DOCKER_HOST environment variable to point to the remote host.
🌐
GitHub
gist.github.com › kekru › 4e6d49b4290a4eebc7b597c07eaf61f2
Run commands on remote Docker host
You also could set DOCKER_HOST in your session ... ... root@dfmix-easycards01-pltf:/etc/gitlab-runner# docker run -p 80:2375 -v /var/run/docker.sock:/var/run/docker.sock jarkt/docker-remote-api