Get started with containerization and microservices on your Raspberry Pi 4 with Docker!

A step-by-step guide to installing Docker on Raspberry Pi 4, the popular single board computer for building all kinds of projects. …


Updated October 16, 2023

Need help with your Raspberry Pi?
Contact Me!

Do you love silly Raspberry Pi Projects?
Check out my this YouTube Channel!


A step-by-step guide to installing Docker on Raspberry Pi 4, the popular single board computer for building all kinds of projects.

Docker is an open platform that allows developers to package their applications and dependencies into containers, making it easy to deploy and run them consistently across different environments. It has become a widely used tool in the world of software development due to its ability to simplify deployment processes, improve scalability, and provide better resource utilization. Docker can be installed on various platforms including Raspberry Pi 4, a popular single board computer for building all kinds of projects. In this article, we will guide you through the process of installing Docker on your Raspberry Pi 4.

Prerequisites:

Before getting started with the installation process, make sure that you have the following:

  • A Raspberry Pi 4 device with Raspbian Buster Lite or Raspberry Pi OS (32-bit) installed. You can download the latest version of Raspberry Pi OS from here.
  • An SSH client (like PuTTY for Windows, Terminal for macOS and Linux, or a terminal emulator for Android) to access your Raspberry Pi over the network.

Step 1: Update Your System

To ensure that you have the latest packages and software versions, start by updating your system using the following commands in the terminal:

sudo apt update && sudo apt upgrade -y

Wait for the updates to complete before moving on to the next step.

Step 2: Install Docker

To install Docker on Raspberry Pi 4, we will use the official Docker repository. First, add the Docker GPG key and then the Docker repository:

curl -fsSL https://download.docker.com/linux/raspbian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=armhf signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/raspbian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Next, update the package index and install Docker:

sudo apt update && sudo apt install docker-ce -y --no-install-recommends

Wait for the installation to complete before moving on to the next step.

Step 3: Add Your User to the Docker Group

To use Docker without sudo, add your user to the docker group:

sudo usermod -aG docker $USER

Log out and log back in again for the changes to take effect.

Step 4: Verify Your Installation

Finally, verify that Docker is installed correctly by running a simple test command:

docker run hello-world

You should see output similar to the following:

Hello from Docker!
This message shows that your installation appears to be working correctly.
...

Congratulations! You have successfully installed Docker on your Raspberry Pi 4. Now, you can start building and running containerized applications on this versatile device.