Blog

Install Docker on a Raspberry Pi

Linux1 December 2025

Docker has revolutionized how developers build, ship, and run applications, making complex setups portable and consistent. Running Docker on a Raspberry Pi opens up a world of possibilities for home labs, IoT projects, edge computing, and small-scale servers. Its lightweight nature and ARM architecture compatibility make the Raspberry Pi an excellent platform for containerized applications.

This guide will walk you through the steps to get Docker up and running on your Raspberry Pi, allowing you to deploy applications with ease.

Prerequisites

Before we begin, ensure you have the following:

  • A Raspberry Pi: Raspberry Pi 3, 4, or 5 are recommended for better performance. This guide assumes you are running Raspberry Pi OS (formerly Raspbian), either the Lite (headless) or Desktop version.
  • An active internet connection: Necessary for downloading packages.
  • SSH access or direct keyboard/monitor access: To execute commands on your Pi.

Step 1: Update Your Raspberry Pi

It's always a good practice to start with an up-to-date system. This ensures you have the latest security patches and package versions, which can prevent compatibility issues during the Docker installation.

Open your terminal and run:

sudo apt update
sudo apt full-upgrade -y

After the upgrade, it's a good idea to reboot your Pi, especially if the kernel or critical system components were updated.

sudo reboot

Step 2: Install Docker on Raspberry Pi

Docker provides a convenient script to install Docker Engine on various Linux distributions, including Raspberry Pi OS. This is generally the easiest and recommended method.

First, download the script:

curl -fsSL https://get.docker.com -o get-docker.sh

Now, execute the script to install Docker:

sudo sh get-docker.sh

This script will detect your system architecture (ARM for Raspberry Pi) and install the appropriate Docker packages. The installation might take a few minutes depending on your internet speed and Pi model.

Step 3: Verify Docker Installation

Once the installation is complete, you can verify that Docker Engine is running correctly.

Check the Docker service status:

sudo systemctl status docker

You should see output indicating that the Docker service is active (running).

To further verify, run the classic hello-world container:

sudo docker run hello-world

If successful, you will see a message indicating that your installation appears to be working correctly. This means Docker pulled the hello-world image and ran it in a new container.

By default, only the root user and members of the docker group can execute Docker commands. To avoid using sudo every time you run a Docker command, you can add your user to the docker group.

Replace your-username with your actual Raspberry Pi username (e.g., pi if you're using the default).

sudo usermod -aG docker your-username

After adding your user to the docker group, you need to either log out and log back in, or reboot your Raspberry Pi for the changes to take effect.

sudo reboot

Once logged back in, you should be able to run Docker commands without sudo:

docker run hello-world

Basic Docker Commands to Get Started

Now that Docker is installed, here are a few fundamental commands to help you get started:

  • Pull an image: Download an image from Docker Hub.
    docker pull debian:latest
    
  • List images: See all downloaded Docker images.
    docker images
    
  • Run a container: Create and start a container from an image.
    docker run -it debian:latest /bin/bash
    
    (This will give you a shell inside a Debian container. Type exit to leave.)
  • List running containers: View all actively running containers.
    docker ps
    
  • List all containers (running and stopped):
    docker ps -a
    
  • Stop a container: Stop a running container using its ID or name.
    docker stop <container_id_or_name>
    
  • Remove a container: Delete a stopped container.
    docker rm <container_id_or_name>
    
  • Remove an image: Delete a Docker image.
    docker rmi <image_id_or_name>
    

Conclusion

You've successfully installed Docker on your Raspberry Pi! This powerful setup allows you to deploy applications in isolated, portable containers, making your Raspberry Pi an even more versatile tool for a myriad of projects. Whether you're experimenting with IoT services, hosting a lightweight web server, or building an edge computing device, Docker on Raspberry Pi provides a robust and flexible foundation.

Start exploring Docker Hub for ARM-compatible images, and unleash the full potential of your Raspberry Pi with containerization!


This post contains affiliate links. As an Amazon Associate, I earn from qualifying purchases you make. This means I may earn a small commission if you purchase through my links at no extra cost to you.