At the end of May 2020, the Raspberry Pi Foundation announced Raspberry Pi OS, the new official operating system for the mini-computer that is replacing Raspbian.
The good news is that Raspberry Pi OS does support Docker and Docker Compose, in both the 32-bit and 64-bit variants! Read below on how to install it as well as Docker Compose.
Installation
Installing Docker
Installing Docker CE (Community Edition) on the Raspberry Pi OS requires running just a few commands.
The best way to install Docker is to fetch it from the official Docker repositories, so to ensure that you’re always running the latest version.
To install Docker CE on Raspberry Pi OS, both 32-bit and 64-bit, run:
Hello from Docker! This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (arm32v7) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal.
To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/
For more examples and ideas, visit: https://docs.docker.com/get-started/
Install Docker Compose
Lastly, let’s look at how to add Docker Compose.
Docker Compose is normally installed from pre-built binaries, downloaded from the GitHub release page for the project. Sadly, those are not available for the ARM architecture.
We can however install Docker Compose from pip:
1 2 3 4 5 6 7
# Install required packages sudo apt update sudo apt install -y python3-pip libffi-dev # Install Docker Compose from pip (using Python3) # This might take a while sudo pip3 install docker-compose
With this, you now have a complete Raspberry Pi mini-server running Docker and ready to accept your containers.