How to Install Docker on Your Raspberry Pi

Tyler Tyler (304)
15 minutes

What is docker?

Docker is a tool that allows you to deploy applications inside of software containers. With Docker, images are used to configure the operating system and install an application's dependencies. Then from the image, containers are created to run the application.

Docker on the Raspberry Pi

Docker can be useful on the Raspberry Pi because it allows users to run applications with very little overhead. As long as the application is packaged inside of a Docker image, you can simply install Docker and run the container.

This guide will walk you through the process of installing docker and docker-compose on any version of Raspberry Pi OS.

Posted in these interests:
h/docker12 guides
h/pi236 guides

We can easily install docker using a shell script provided by (none other than) docker.

curl -sSL | sh

If you prefer to inspect scripts before executing them, you can split this command into two pieces:

curl -sSL -o

# Make sure looks right


If you try to run some docker commands, you'll notice a "permission denied" error, which indicates docker can only be run by the root user (using sudo). If you would like to run docker commands as your non-root user (default is pi), you can run the following:

sudo usermod -aG docker pi

The usermod command with -aG will append (-a) the user to the groups (-G). In the above case, we are adding the pi user to the docker group. This enabled pi to run docker commands. You can obviously substituted any user if you are not using the default pi user.

You can verify this with the following command:

groups pi

Ensure docker is listed as one of the groups.

To test docker, we'll run the hello-world image.

docker run hello-world

If Docker is installed properly, you'll see a "Hello from Docker!" message.

docker-compose is a tool that lets you define and manage your infrastructure using YAML configuration files. It's especially useful when your application requires multiple interdependent services.

To install docker-compose on your Raspberry Pi, you can use the pip3 command.

 sudo pip3 -v install docker-compose
Tyler Tyler (304)

In this short guide, we'll learn how to install Docker Engine on any platform. Before we begin, we should make the distinction between Docker Engine (Enterprise) and Docker Engine (Community).