Archive for October, 2023

Setting up Docker Client to connect to remote daemon using CLI

Sunday, October 29th, 2023

On Docker Daemon

IP: 192.168.100.100

user@docker:~$ sudo systemctl edit docker.service

ExecStart=/usr/bin/dockerd -H fd:// -H tcp://127.0.0.1:2375

user@docker:~$ sudo systemctl restart docker.service

user@docker:~$ sudo netstat -lntp | grep dockerd
tcp 0 0 127.0.0.1:2375 0.0.0.0:* LISTEN 170/dockerd

On Docker Client

user@client:~$ ssh-keygen

user@client:~$ ssh-copy-id 192.168.100.100

user@client:~$ docker context create node2
–description “Node 2” \
–docker “host=ssh: //$TARGET _HOST”

user@client:~$ docker context use node2

user@client:~$ docker ps

CONTAINER ID   IMAGE                        COMMAND                  CREATED          STATUS         PORTS                                       NAMES

0cf710e9fdbf   hello:2          “/docker-entrypoint.???”   12 minutes ago   Up 7 minutes   1883/tcp                                    container-1