Installing Docker on Raspberry Pi

Image

Docker can easily be installed on Raspberry Pi. The official Docker documentation states that you need to download and execute a Docker convenience script. This is described in detail here.

So here are the steps to get Docker installed on Raspberry Pi:

# get the docker script
curl -fsSL https://get.docker.com -o get-docker.sh
# make it executable
chmod a+x get-docker.sh
# execute the script
./get-docker.sh

Note, that you will have to execute the above as root. If you don’t want to use root everytime you use Docker, you might want to add your own user to the docker group:

sudo usermod -aG docker <your-user>

After that you will likely have to log off and on again to have the group changes applied.

Installing Docker Compose

To install Docker Compose on Raspi, simply follow How to install Docker and Docker Compose on Raspberry Pi.

In short:

sudo apt-get install libffi-dev libssl-dev
sudo apt install python3-dev
sudo apt-get install -y python3 python3-pip
sudo pip3 install docker-compose

Uninstalling Docker Engine

# Uninstall the Docker Engine, CLI, and Containerd packages
sudo apt-get purge docker-ce docker-ce-cli containerd.io

# Images, containers, volumes, or customized configuration files on your host are not automatically removed. 
# To delete all images, containers, and volumes:
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd

Docker Images for Raspi 4B

Raspberry Pi 4B uses an arm32v7 chip. You will need docker images that were built for this kind of architecture.

For Java Open JDK implementations you can look at OpenJDK Docker Images for Raspberry Pi (Armv7) and Alternative arm32v7 Open JDK Images.

For other technologies that have been dockerized for arm32v7, have a look at the arm32v7 Docker Hub organization.

References