SSH remote Docker host
January 10, 2019
ssh
Let’s attempt to use SSH port forwarding to tunnel a remote Docker host to out local machine, granting us access to resources as if they are running locally.
First tunnel remote socket to a port on local machine.
ssh -nNT -L localhost:2345:/var/run/docker.sock [email protected]
Flag n
prevents reading from stdin, N
does not execute any command and T
will not allocate a PTY.
Next open a new terminal and export DOCKER_HOST.
export DOCKER_HOST="localhost:2345"
While using this terminal, local docker commands are executed on remote server.