Why use docker client ? Because don't want to / cannot install docker engine in the client environment and just want to connect to the docker engine on local LAN.
(1) For Windows 10 Host, after installation of docker desktop
# C:\ProgramData\Docker\config\daemon.json and add
"hosts" : ["tcp://0.0.0.0:2375"],# change port forwarding to docker wsl backend, run this in powershell admin mode
netsh interface portproxy add v4tov4 listenport=2375 listenaddress=192.168.64.1 connectaddress=127.0.0.1 connectport=2375# change Windows defender firewall and add incoming rule to enable port 2375 # Refer to this for setting openssh server authorized_keys, with proper file permission https://superuser.com/questions/1445976/windows-ssh-server-refuses-key-based-authentication-from-client
(2) For macOS Host, after installation of docker desktop
# ssh-keygen in client and ssh-copy-id to host, e.g. remote host username with ip address of 192.168.64.1
ssh-keygen -t rsa ssh-copy-id username@192.168.64.1# edit sshd_config
sudo vi /private/etc/ssh/sshd_config# and add
PermitUserEnvironment PATH,LANG# edit ~/.docker/daemon.json and add
"hosts" : ["tcp://0.0.0.0:2375"],# add .ssh/environment
PATH=$PATH:/usr/local/bin# restarting sshd using macOS System Preferences -> Sharing -> File Sharing
(3) To install docker client for Linux using tcp
cd ~/ wget https://download.docker.com/linux/static/stable/x86_64/docker-20.10.6.tgz tar -xzvf docker-20.10.6.tgz cd docker ./docker -H tcp://<remote host ip address>:2375 images
(3.1) To install docker client for Termux app of Android and using tcp
wget https://download.docker.com/linux/static/stable/aarch64/docker-20.10.6.tgz tar xzvf docker-20.10.6.tgz mv docker/docker /data/data/com.termux/files/usr/bin/ ./docker -H tcp://<remote host ip address>:2375 images
(4) To install docker client for macOS using ssh
cd ~/ wget https://download.docker.com/mac/static/stable/x86_64/docker-20.10.6.tgz #or curl -OL https://download.docker.com/mac/static/stable/x86_64/docker-20.10.6.tgz #or curl -OL https://download.docker.com/mac/static/stable/aarch64/docker-20.10.6.tgz tar xzvf docker-20.10.6.tgz xattr -rc docker cd docker sudo mkdir -p /usr/local/bin sudo mv * /usr/local/bin/ docker -H ssh://username@<remote host ip address> images
(5) Or simply add the corresponding variables to ~/.bashrc
unset DOCKER_HOST
# for tcp connection to Windows 10 host
export DOCKER_HOST=tcp://192.168.64.1:2375
# for ssh connection to macOS host using SSH
export DOCKER_HOST=ssh://user@192.168.64.1
No comments:
Post a Comment