Docker and Docker Compose are convenient tools if you need to run some software without bloating your system with dependencies that you don’t use on a daily basis so Docker was one of the first things I wanted to install on my new Raspberry Pi 4. A few DuckDuckGo searches revealed that Docker seems to support armhf, but it’s impossible to install it on Raspbian in the same way as it’s usually done on other Linux distributions. One of the remaining options is to install Docker from the latest binaries and this post shows how to do that.
Table of Contents
Where to Get Binaries
You can see the latest armhf
builds here: https://download.docker.com/linux/debian/dists/buster/pool/stable/armhf/
You can pick any version, but it’s important do download all 3 parts of Docker: docker-ce
, docker-ce-cli
and containerd.io
.
Let’s download them all (don’t forget to update file names if the versions listed below are no longer available):
curl -o docker-ce.deb https://download.docker.com/linux/debian/dists/buster/pool/stable/armhf/docker-ce_19.03.1~3-0~debian-buster_armhf.deb \
&& curl -o docker-ce-cli.deb https://download.docker.com/linux/debian/dists/buster/pool/stable/armhf/docker-ce-cli_19.03.1~3-0~debian-buster_armhf.deb \
&& curl -o containerd.io.deb https://download.docker.com/linux/debian/dists/buster/pool/stable/armhf/containerd.io_1.2.6-3_armhf.deb
Now we can install downloaded binaries with the following command:
sudo dpkg --install docker-ce.deb docker-ce-cli.deb containerd.io.deb
That’s it! Let’s verify that Docker is installed:
docker -v
Docker version 19.03.1, build 74b1e89
We can also check that all of those packages were installed:
apt list --installed | egrep 'docker|containerd'
containerd.io/now 1.2.6-3 armhf [installed,local]
docker-ce-cli/now 5:19.03.1~3-0~debian-buster armhf [installed,local]
docker-ce/now 5:19.03.1~3-0~debian-buster armhf [installed,local]
Now it’s time to run a “Hello World” image as a final test:
sudo docker run hello-world
Don’t forget to remove downloaded packages as they are no longer required:
rm docker-ce.deb docker-ce-cli.deb containerd.io.deb
Optional: Using Docker Without sudo
sudo usermod -aG docker $USER
Installing Docker Compose
Is seems that docker-compose package included in Raspbian apt repository doesn’t work, so we have to find an alternative way to install Docker Compose. Luckily for us, it is also available in pip repository and Raspbian has the pip utility (part of python3-pip
package) out of the box so let’s use it in order to install Docker Compose globally:
sudo pip3 install docker-compose
Make sure you use sudo
because without it you wouldn’t be able to access docker-compose
globally.
Let’s verify our installation:
docker-compose -v
docker-compose version 1.24.1, build 4667896
That’s it! Now we have a functional installation of Docker and Docker Compose on a Raspberry Pi computer.
How to Remove Docker and Compose
Here are the commands:
sudo pip3 uninstall docker-compose \
&& sudo dpkg --remove docker-ce docker-ce-cli containerd.io
Conclusion
It’s possible to run Docker and Docker Compose on Raspberry Pi 4, although it requires a few hacks and workarounds. I hope that the installation process will be easier in the future but, for someone who is not ready to wait, the solution listed above might be a good option.