0
votes

On my Pi I followed this tutorial to install docker on raspbian. Few side notes here:

  1. I did NOT setup a swarm, I stopped at docker info and (as in other guides) I succesfully ran the hello world container.
  2. idk if it matters, but this guide (unlike others) had me edit /etc/apt/sources.list and add line: deb https://download.docker.com/linux/raspbian/ stretch stable

On my develop machine (win 10) I used this tutorial to add docker configs and ymls to my mern stack app. However at multiple points in this tutorial they wanted me to run docker commands, so I ended up having to install Docker Desktop.

But I don't want to use local containers, I want to use the remote one on my Pi. So I used this tutorial to try and setup my remote docker.

However Im getting an error:

C:\Users\oweng>docker-machine create --driver generic --generic-ip-address=192.168.1.2 --generic-ssh-key "%HOMEPATH%/.ssh/id_rsa" --generic-ssh-user=pi remote-docker-host Running pre-create checks... Creating machine... (remote-docker-host) Importing SSH key... Waiting for machine to be running, this may take a few minutes... Detecting operating system of created instance... Waiting for SSH to be available... Enter passphrase for key 'C:\Users\oweng.docker\machine\machines\remote-docker-host\id_rsa': Enter passphrase for key 'C:\Users\oweng.docker\machine\machines\remote-docker-host\id_rsa': Detecting the provisioner... Enter passphrase for key 'C:\Users\oweng.docker\machine\machines\remote-docker-host\id_rsa': Error creating machine: Error detecting OS: OS type not recognized

I have googled the error a bit but havnt found a solution.

furthermore when checking listening ports on my Pi (docker server) I dont see it running

pi@raspberrypi:~ $ sudo lsof -i -P -n | grep LISTEN xrdp-sesm 390 root 7u IPv6 14566 0t0 TCP [::1]:3350 (LISTEN) sshd
404 root 3u IPv4 17224 0t0 TCP *:22 (LISTEN) sshd
404 root 4u IPv6 17226 0t0 TCP *:22 (LISTEN) xrdp
406 xrdp 11u IPv6 17302 0t0 TCP *:3389 (LISTEN)

So I feel like maybe the server is not running? But it seems to be.

pi@raspberrypi:~ $ systemctl status docker ● docker.service - Docker Application Container Engine Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2020-11-03 07:18:21 PST; 3h 35min ago Docs: https://docs.docker.com Main PID: 496 (dockerd) Tasks: 13 CGroup: /system.slice/docker.service └─496 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Nov 03 07:18:14 raspberrypi dockerd[496]: time="2020-11-03T07:18:14.064113743-08:00" level=warning msg="Your kernel does not support cgroup blkio throttle.w Nov 03 07:18:14 raspberrypi dockerd[496]: time="2020-11-03T07:18:14.064249212-08:00" level=warning msg="Your kernel does not support cgroup blkio throttle.r Nov 03 07:18:14 raspberrypi dockerd[496]: time="2020-11-03T07:18:14.064373483-08:00" level=warning msg="Your kernel does not support cgroup blkio throttle.w Nov 03 07:18:14 raspberrypi dockerd[496]: time="2020-11-03T07:18:14.066367493-08:00" level=info msg="Loading containers: start." Nov 03 07:18:17 raspberrypi dockerd[496]: time="2020-11-03T07:18:17.612685200-08:00" level=info msg="Default bridge (docker0) is assigned with an IP address Nov 03 07:18:18 raspberrypi dockerd[496]: time="2020-11-03T07:18:18.710629367-08:00" level=info msg="Loading containers: done." Nov 03 07:18:20 raspberrypi dockerd[496]: time="2020-11-03T07:18:20.815943637-08:00" level=info msg="Docker daemon" commit=4484c46 graphdriver(s)=overlay2 v Nov 03 07:18:20 raspberrypi dockerd[496]: time="2020-11-03T07:18:20.822947178-08:00" level=info msg="Daemon has completed initialization" Nov 03 07:18:21 raspberrypi systemd1: Started Docker Application Container Engine. Nov 03 07:18:21 raspberrypi dockerd[496]: time="2020-11-03T07:18:21.273201136-08:00" level=info msg="API listen on /var/run/docker.sock"

Update 1

following this SO post i was able to get the server running it seems. Editing docker.service file. I now get a different error when trying to create

C:\Users\oweng>docker-machine create --driver generic --generic-ip-address=192.168.1.2:2137 --generic-ssh-key "%HOMEPATH%/.ssh/id_rsa" --generic-ssh-user=pi remote-docker-host Running pre-create checks... Creating machine... (remote-docker-host) Importing SSH key... Waiting for machine to be running, this may take a few minutes... Error creating machine: Error waiting for machine to be running: Maximum number of retries (60) exceeded

Update 2 BMitch's comment lead me to these two tutorial which seem to be exactly what im trying todo https://code.visualstudio.com/docs/containers/ssh https://code.visualstudio.com/docs/containers/choosing-dev-environment#_remote-machine

1

1 Answers

1
votes

I wouldn't use docker-machine for that. Support for the tool seems to be going away, and there are much easier methods.

The easiest is to set DOCKER_HOST on your machine to be the ssh setting of the remote node:

export DOCKER_HOST=ssh://user@host
docker info # should now show the remote host if you have ssh access

If you find yourself changing between nodes a lot, I'd recommend setting up a context and then leaving DOCKER_HOST unset:

unset DOCKER_HOST
docker context create rpi --description "Pi" --docker "host=ssh://user@host"
docker --context rpi info

You can then make the context the new default with

docker context use rpi

And switch back to the local/default docker engine with

docker context use default