Saturday, September 26, 2020

Connect Docker Client to Remote Docker Host

This article will help to connect a Docker client to a remote Docker host Server.


Docker Server is installed on remote Docker host server 

Docker Client is installed on the client machine.

Docker Client must have ssh connectivity with the remote server

To Setup the ssh key

On Docker Client 

$ ssh-keygen

$ cat /<<user>>/.ssh/

copy these contents and got to remote server

On Docker Remote Server

append the content of client's ssh key to /<<user>>/.ssh/authorizedkeys

On Docker Client 

export DOCKER_HOST=ssh://<<user>>@<<RemoteIP>>

Now your client is connected to Remote Host Machine.

if you run docker commands it will connect to Remote Docker server.

How to disconnect to Remote server

$  unset DOCKER_HOST


Unknown said...

Not able to connect docker server from Docker client machine. Please suggest.

Server - (private) (Public)
Client - (Private) (Public)

ubuntu@ip-172-31-24-217:~/.ssh$ export DOCKER_HOST=ssh://ubuntu@
ubuntu@ip-172-31-24-217:~/.ssh$ docker --version

Command 'docker' not found, but can be installed with:

sudo snap install docker # version 19.03.11, or
sudo apt install

See 'snap info docker' for additional versions.

------ Checking Connection ----------
ubuntu@ip-172-31-24-217:~/.ssh$ ssh ubuntu@
Welcome to Ubuntu 18.04.5 LTS (GNU/Linux 5.3.0-1035-aws x86_64)

* Documentation:
* Management:
* Support:

System information as of Tue Sep 29 19:35:51 UTC 2020

System load: 0.0 Processes: 94
Usage of /: 21.2% of 7.69GB Users logged in: 1
Memory usage: 20% IP address for eth0:
Swap usage: 0%

36 packages can be updated.
31 updates are security updates.

New release '20.04.1 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

Last login: Tue Sep 29 19:27:15 2020 from

Raman said...

First you need to install docker on client system

Jersey Shore Technology said...

Secure Speech Recognition kiosk CenterThank you so much uploading this is very helpful to us. Great work!

DevOps Enabler & Co. said...

wonderful post. this is very well written and unique. Thank you for sharing this post here. keep sharing this in future. Managed Devops Solutions

Post a Comment