Install Docker on a Raspberry Pi
Learn how to install Docker on a Raspberry Pi in this tutorial and run your first containerised application.
In this tutorial, I'll guide you through installing Docker Raspberry Pi. By the end of the tutorial, you will learn how to install Docker, and run your first containerised application.
What is Docker?
Docker is a technology that lets you run various operating systems and applications wihtin their own self-contained container, in its simplest form.
Before starting this tutorial, you should be comfortable using terminal and have the latest version of Raspberry Pi OS running on your Raspberry Pi. In this tutorial, I'll be using a Raspberry Pi 4 Model B with 4GB of RAM.
Step 1 - Install Docker
Let's begin by making sure we've got all OS updates installed before we install docker:
sudo curl -s https://get.docker.com | bash
This will run a script which will install Docker and required dependencies on your Raspberry Pi. Once the installation has completed, you will see conformation:
Step 2 - Add your user to the docker group
Docker is now installed and will work for root users on our Raspberry Pi, but we want our
pi user to be able to administer containers in Docker. For this, we need to add our
pi user to the
sudo usermod -aG docker pi
For this setting to apply, we need to logout and log back in again. Once we've done this, we should be able to run docker commands as the
Step 3 - Running our first containerised application
Now that Docker is installed, let's test our installation by running our first containerised application, the 'hello-world' container:
docker run hello-world
We should see the following:
Great! Docker is up and running.
- Learn how to install Portainer to manage Docker containers on your Raspberry PI
Feel free to provide feedback in the comments. Let me know in the comments what Docker based tutorials you'd like me to cover next.