Update: There is a new official OS for Raspberry Pi boards: Raspberry Pi OS, which is available in both 32-bit and 64-bit variants.
Check out how to install Docker and Docker Compose on Raspberry Pi OS in the updated article.
This post is the definitive guide on using Docker on a Raspberry Pi, something I wish I had one week ago. I have a couple of Raspberry Pi’s to provide services for my home and using Docker seemed the simplest way to deploy them. However, the number of guides for doing that on the internet is relatively low.
Docker Raspberry Pi Projects (468) Vue Docker Projects (459) Docker Terraform Projects (446) Docker Machine Learning Projects (438) Go Docker Kubernetes Projects (425). Docker-compose version 1.26.2, build unknown docker-py version: 4.3.0 CPython version: 3.7.3 OpenSSL version: OpenSSL 1.1.1d 10 Sep 2019. Raspberry PI Camera Setup. In order to try Tensorflow object detection in real time on the Raspberry PI we need to have a camera installed on the PI. I will assume that you have already done that. Most Raspberry Pis run on the official operating system Raspberry Pi OS, which is an adaptation of the Linux distribution Debian.Since Docker has been used successfully for many scenarios on Linux, using it with Raspberry Pi shouldn’t be a problem. The goal of this guide is to show you the necessary steps to get you started with Docker on a Raspberry Pi. Please follow the guide that covers your operating system and continue below once you have finished.- The Windows guide for setting up Docker on a Raspberry Pi- The Mac OS X guide for setting up Docker on a Raspberry Pi.
Turns out there’s plenty of good news. Docker does run on Raspberry Pi 2, 3 and 4, and you don’t need any other OS beside Raspbian, the most popular and widely supported distribution. Even better: you can also install Docker Compose.
Please note, however, that users are reporting issues with trying to install Docker on Raspberry Pi 1 and Zero, because of the different CPU architecture.
Installing Docker CE on Raspbian (Stretch or Buster) for Raspberry Pi is straightforward, and it’s fully supported by Docker. Docker CE is not supported on Raspbian Jessie anymore, so I’d recommend upgrading to a more recent release.
We’re going to install Docker from the official Docker repositories. While there are Docker packages on the Raspbian repos too, those are not kept up to date, which is something of an issue with a fast-evolving software like Docker.
To install Docker CE on Raspbian Stretch and Buster:
That’s it! The next step is about starting Docker and enabling it at boot:
Now that we have Docker running, we can test it by running the “hello world” image:
If everything is working fine, the command above will output something similar to:
About ARM images
This should hardly come as a surprise, but there’s a caveat with running Docker on a Raspberry Pi. Since those small devices do not run on x86_64, but rather have ARM-based CPUs, you won’t be able to use all the packages on the Docker Hub.
Instead, you need to look for images distributed by the arm32v7 organization (called armhf before), or tagged with those labels. Good news is that the arm32v7 organization is officially supported by Docker, so you get high-quality images.
While the CPUs inside Raspberry Pi 3’s and 4’s are using the ARMv8 (or ARM64) architecture, Raspbian is compiled as a 32-bit OS, so using Raspbian you’re not able to run 64-bit applications or containers.
Many common applications are already pre-built for ARM, including a growing number of official images, and you can also find a list of community-contributed arm32v7 images on Docker Hub. However, this is still a fraction of the number of images available for the x86_64 architecture.
Installing Docker Compose
In this last step we’re installing Docker Compose.
The official installation method for Linux, as in the Docker documentation, points users to the GitHub downloads page, which however does not offer pre-built binaries for the ARM architecture.
Raspberry Pi 2 Docker Performance
Luckily, we can still easily install Docker Compose from pip:
Raspberry Pi 2 Docker Install
With this, you now have a complete Raspberry Pi mini-server running Docker and ready to accept your containers.