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@serverforDOCKER_HOSTand-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_HOSTvariable (almost always the default local socket) and forward that connection on the commands stdio.
Even though this command is supposed to run locally to thedockerdbinary, we think that it is an invalid configuration for this feature to remove the localdockerbinary 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:
Answer from VonC on Stack OverflowFrom 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 openingdockerdTCP w/o TLS and just opt for SSH endpoints for remote mgmt.
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.
Connect to remote docker host
linux - `docker run` on a remote host - Stack Overflow
Deploying to remote Docker Instance - Waypoint - HashiCorp Discuss
Docker command execution on remote host extremly slow on Windows 10
Videos
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@serverforDOCKER_HOSTand-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_HOSTvariable (almost always the default local socket) and forward that connection on the commands stdio.
Even though this command is supposed to run locally to thedockerdbinary, we think that it is an invalid configuration for this feature to remove the localdockerbinary 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 openingdockerdTCP w/o TLS and just opt for SSH endpoints for remote mgmt.
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.