Raspi 4 Docker

/ Comments off

One way you can use Raspberry Pi and Docker together is for Swarm. Used together, they can create a computer cluster. With Swarm containers on a bunch of networked Raspberry Pis, you can build a powerful machine and explore how a Docker Swarm works. Alex shows you how in this video. The speed and performance of the new Raspberry Pi 4 is a step up from earlier models. For the first time, we've built a complete desktop experience. Whether you're editing documents, browsing the web with a bunch of tabs open, juggling spreadsheets or drafting a presentation, you'll find the experience smooth and very recognisable — but on a. I bought a Pi 4 especially to run Docker faster and though I’d have to wait for Docker to work until Buster was actually officially released cxt666 (Cxt666) July 11, 2019, 10:28am.

At the end of May 2020, the Raspberry Pi Foundation announcedRaspberry Pi OS, the new official operating system for the mini-computer that is replacing Raspbian.

After writing image to SD card insert it into Raspberry Pi 3/4, connect it to monitor add keyboard and switch it on. First time load takes more time than it usually takes. After that using program raspi-config enable SSH connection, change name, set password, connect to WiFi (wired connection is recommended for server for more stability). The Raspberry Pi 4 comes with a wireless adapter built-in, so you could utilize that as well. Creating the cluster. There are tons of blog posts out there that show you how to create a cluster of Raspberry Pi with Docker Swarm. I found How to run a Raspberry Pi cluster with Docker Swarm was clear and easy to follow. All of the details you need.

The announcement also came with the news that Raspberry Pi OS is now available in a 64-bit variant, compatible with Raspberry Pi 3 and 4. This is in addition to the 32-bit variant that has been maintained since the early days.

For the first time, users of the Raspberry Pi boards can enjoy a 64-bit operating system that is officially developed and supported by the Foundation itself. This is particularly great news especially for developers, people who are self-hosting services, and just tinkerers.

The good news is that Raspberry Pi OS does support Docker, in both the 32-bit and 64-bit variants! Read below on how to install it as well as Docker Compose.

Note: This article is written for Raspberry Pi 2, 3 and 4 running Rasperry Pi OS. Older models of the board and Raspberry Pi Zero are currently not supported.
Additionally, if you are using a different distribution for your board besides the official Raspberry Pi OS, the instructions below are not guaranteed to work for you.

Raspi 4 Docker

Choosing the right version of Raspberry Pi OS

You can download the images for Raspberry Pi OS from the official website.

As of writing, images for the 64-bit variant are still in beta and can be found here.

Once you have downloaded the IMG file (which is compressed, so unzip it first) you can use the Raspberry Pi Imager to write the operating system in a SD card.

Raspi 4 Dockers

As for which image to choose, Docker works on all variants and editions of Raspberry Pi OS.

32-bit vs 64-bit

The 32-bit edition of Raspberry Pi OS will run on every board, including Raspberry 2.

If you have a Raspberry Pi 3 or 4, you have the opportunity to pick the 64-bit variant too. Using a 64-bit operating system will give you better performance and it’s required to take advantage of the full amount of memory of the 8GB Raspberry Pi 4 board.

The variant you pick will affect the Docker images you’ll be able to run. We’ll look into that below.

Desktop vs Lite

As the names suggest, the Desktop edition comes with a graphical user interface and the ability to run desktop apps. The Lite edition is headless, offering only access to the command line.

Both editions of Raspberry Pi OS can run Docker.

Raspi 4 Docker

If you plan to use your Raspberry Pi as a headless server, pick the Lite edition to save disk space and reduce memory usage (and have a smaller potential attack surface). You will be able to control the server remotely via SSH.

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:

Done! At this point, we just need to run two more commands to have the Docker service started and automatically launched at boot.

Now that we have Docker running, we can test it by running the “hello world” image:

If everything is working, the command above will output something similar to:


Docker images for 32 and 64 bit ARM

On Docker Hub, the number of images for the ARM architecture used by the Raspberry Pi is growing by the day. Even though the majority of images are still only available for the x86 architecture (used by Intel and AMD CPUs, for example), the amount of ARM-compatible images is increasing steadily.

Additionally, because of the growing popularity of 64-bit ARM in certain cloud providers, it might be especially easier to find 64-bit Docker containers.

Raspberry Pi 4 Docker Server

When searching for an image on Docker Hub, you can filter by operating system and architecture, where “ARM” refers to the 32-bit variant.

Raspberry Pi 4 Docker Portainer

In the Docker ecosystem, 64-bit ARM images are called arm64 or arm64/v8.

Likewise, 32-bit images for Raspberry Pi OS are labeled as armhf, armv7, or arm/v7.

Using 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:


Raspi 4 Docker

With this, you now have a complete Raspberry Pi mini-server running Docker and ready to accept your containers.