SSH Remoting

SSH Remoting

Features

Specify Docker host using ssh:// schema

docker --host ssh://[<user>@]<host> version

SSH agent should be used for authentication

Support

Added in Docker 18.09

Required on server and client

Demo: SSH Remoting

Test containerized

Run SSH agent:

eval $(ssh-agent -s)
ssh-add .ssh/id_rsa

Authorise SSH key:

cp ./.ssh/id_rsa.pub ./.ssh/authorized_keys

Run container with Docker and SSH:

docker run --name ssh \
    --detach \
    --privileged \
    remoting-ssh

Alternative

Forward Docker socket through SSH:

ssh -fNL $HOME/.docker.sock:/var/run/docker.sock user@host

Use forwarded socket:

docker --host unix://$HOME/.docker.sock version