How to install docker in the raspberry pi zero manually

Xavier Alves
3 min readOct 17, 2021

While attempting to start to run some personal projects in a small raspberry I had some issues while attempting to install Docker. After I realised what I was doing wrong I decided to share what I did to accomplish.

Environment

To develop the projects I like to setup a Linux VM where I can configure all the needed dependencies(IDE, java versions, etc…) so that later on I can simply delete this VM if something goes wrong. Therefore, the first step was to connect through ssh to the raspberry pi using windows(through USB using putty), after this was accomplished, I shared the network from the raspberry pi interface to the Linux VM allowing me to manage the raspberry pi from the VM.

Install Docker Manually

For installing docker manually I was first required to download the packages required manually, and I selected the following versions:

  • containerd.io 1.2.13–1
  • docker-ce 19.03.7~3–0-raspian-buster
  • docker-ce-cli 19.03.7~3–0-raspian-buster

To find and download these packages I went to the following link

After you have all these packages downloaded in a folder I needed to add them to raspberry pi, to do this I used the scp command(don't forget to change the <folder_to_copy> and the <raspberry-pi_ip>):

scp -r <folder_to_copy> pi@<raspberry-pi_ip>:/home/pi/Desktop

The above command created the folder under Desktop with the packages inside. Now the next step would be to install the packages, to do so, we will use the dpkg command:

sudo dpkg -i containerd.io_1.2.13-1_armhf.debsudo dpkg -i docker-ce-cli_19.03.7_3–0_raspbian-buster_armhf.debsudo dpkg -i docker-ce_19.03.7_3–0_raspbian-buster_armhf.deb

After this Docker was successfully installed, the only missing optional step is to ensure you can run docker commands without using sudo, to do this run the following:

sudo usermod -aG docker $USERnewgrp docker

Install everything faster

These are just a few steps but if you want to do this faster I have a little repository with these packages and two bash scripts. One to install and the other to remove docker in case you want to uninstall it. The repo can be found here.

In order to install you just need to perform:

sudo ./install-docker.sh

And when you need to delete it:

sudo ./remove-and-purge-docker.sh

Conclusion

And that’s it! :) I faced some issues regarding the incompatibility issues due to the architecture of the raspberry and also some known issues of some versions, so I decided to share the walkthrough in case anyone else wishes to accomplish something similar. This is also my first story on Medium, in case you realised I should improve doing something, feel free to reach out to me!

References

https://docs.docker.com/engine/install/linux-postinstall/

--

--

Xavier Alves

Software Engineer | Occasional gamer | Exploring new technologies