How to Install Docker on Raspberry Pi (2026 Guide)
Installing Docker on a Raspberry Pi takes two commands: curl -fsSL https://get.docker.com -o get-docker.sh and sudo sh get-docker.sh. Docker’s official script detects the Pi’s ARM architecture and sets up Docker Engine and Docker Compose from Docker’s own repository. From then on, every application you run lives in its own container, a self-contained environment that holds the program and all the libraries it needs without touching the rest of your system.
We checked every command in October 2026 on a Raspberry Pi 5 running Raspberry Pi OS (64-bit) with Docker 29 and Docker Compose 5.
In short
The get.docker.com script is the quickest route: it installs Docker and Docker Compose from Docker’s official repository, and from then on updates arrive through apt like any other package.
- You need: a Raspberry Pi 3, 4, 5 or Zero 2 W running the 64-bit version of Raspberry Pi OS, since many images aren’t built for 32-bit ARM.
- Prefer to see every step? Set up the APT repository by hand. Docker then comes from the same repository.
- Before you start: skip the
docker.iopackage from the Raspberry Pi OS repositories. It’s several releases behind and doesn’t include a current Docker Compose.
What Is Docker?
Docker is a container platform. Each application runs in its own container, bundled with every library and dependency it needs. Compared with installing software the classic way through apt, that gives you four advantages:
- Isolation: applications don’t get in each other’s way, even when they need different versions of the same library.
- Portability: a container behaves the same on any machine running Docker, as long as the image is built for that processor architecture.
- Easy updates: pull the new image, recreate the container, done.
- Clean removal: delete a container and nothing is left behind on your system.
Two terms come up constantly. An image is the read-only template of an application, which Docker downloads from the internet, usually from Docker Hub. A container is a running instance of that image, and you can start as many containers from one image as you like.
On a Raspberry Pi, this lets you spin up services such as Pi-hole, Nextcloud, Home Assistant or Vaultwarden in minutes instead of setting each one up by hand.
Requirements
Which Raspberry Pi Works Best?
How many containers a Pi can handle comes down mostly to RAM. Every current model has enough CPU power for typical home server services. For 24/7 use, plan on an SSD instead of an SD card; Use an SSD Instead of an SD Card explains why.
| Model | RAM | Docker suitability |
|---|---|---|
| Raspberry Pi 5* | 4 to 16 GB | Ideal; 8 GB handles larger stacks too |
| Raspberry Pi 4 (4 GB)*, Pi 4 with 8 GB | 4 or 8 GB | Very good |
| Raspberry Pi 4 (2 GB)*, Pi 5 with 2 GB | 2 GB | Fine for a handful of containers |
| Raspberry Pi 3, Pi 5 with 1 GB | 1 GB | Light containers only |
| Raspberry Pi Zero 2 W | 512 MB | One or two very light containers |
| Raspberry Pi 1, Zero, Zero W | 256 to 512 MB | Not suitable: no official Docker packages for these ARMv6 chips |
Operating System: 64-bit Raspberry Pi OS
For Docker, go with a 64-bit operating system. According to Docker’s documentation, Docker Engine 28 was the last release from the old repository for 32-bit Raspberry Pi OS. On a Pi 3, 4, 5 or Zero 2 W, though, a 32-bit system still gets newer releases through Docker’s Debian packages for 32-bit ARM (armhf), and the install script sets those up on its own on current Raspberry Pi OS. The real reason to go 64-bit is the images: many on Docker Hub aren’t built for 32-bit ARM anymore. To check what you’re running:
dpkg --print-architecture
If it says arm64, you’re good to go. armhf means a 32-bit system, so for a Docker server you’re better off reinstalling. Don’t rely on uname -m here: on a Pi 4 or 5 it reports aarch64 even on 32-bit, because those boards run a 64-bit kernel. In the Raspberry Pi Imager, pick “Raspberry Pi OS Lite (64-bit)” under “Raspberry Pi OS (other)”. Lite comes without a desktop, which is the better choice for a server you manage over SSH, since the desktop eats RAM of its own.
Bring the system up to date before you install anything:
sudo apt update && sudo apt full-upgrade -y
Why full-upgrade rather than upgrade? Our guide on updating Raspberry Pi OS explains the difference.
Installing Docker: Two Ways
Both methods get you the same result: Docker Engine, the docker command-line tool, Docker Compose and Buildx, all from Docker’s official repository. The script does the steps for you; with the second method you type them yourself.
| Install script | APT repository by hand | docker.io from Raspberry Pi OS | |
|---|---|---|---|
| Docker version | current (October 2026: 29.9) | current (October 2026: 29.9) | outdated (26.1) |
| Docker Compose | included, current version 5 | included, current version 5 | only as a separate, older package |
| Updates | via apt | via apt | via apt |
| Effort | two commands | seven commands | one command |
| Our take | quickest route | if you want to understand every step | avoid |
If you’ve installed docker.io or another Docker package from the Raspberry Pi OS repositories in the past, remove it first so the packages don’t clash:
for pkg in docker.io docker-doc docker-compose docker-buildx podman-docker containerd runc; do sudo apt remove -y $pkg; done
Method 1: The Install Script
Want to know what the script will do first? Once it’s downloaded, run it as sudo sh get-docker.sh --dry-run and it prints every command without changing anything.
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
The first command downloads the script, the second runs it as root. It recognizes 64-bit Raspberry Pi OS, adds Docker’s Debian repository, installs the packages, starts the Docker service and enables it at boot. Expect two to five minutes, depending on your connection.
Docker itself only recommends the script for testing and development machines, since it installs without asking and offers almost no options. On a freshly set-up Pi, though, it adds exactly the same repository as Method 2. If you’d rather follow Docker’s advice, go with Method 2.
Don’t rerun the script to update Docker later; apt takes care of that, as covered in Updating Docker. Next up: After the Installation.
Method 2: Setting Up the APT Repository by Hand
64-bit Raspberry Pi OS is based on Debian, so you use Docker’s Debian repository, not the older “Raspbian” one, which only carries 32-bit packages. The commands follow Docker’s official Debian instructions, except that you add the repository in the shorter one-line format that Docker’s install script uses too. Start with the signing key that lets apt verify the packages come from Docker:
sudo apt install -y ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
Next, add the repository. The command reads your system’s architecture and release name on its own, so there’s nothing to edit:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list
Then install the packages:
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
The Docker service starts right after the installation and is enabled to start at boot.
After the Installation
Using Docker Without sudo
Out of the box, only root and users running sudo can use Docker. To run Docker commands as your own user, add yourself to the docker group. $USER automatically stands for whoever is logged in:
sudo usermod -aG docker $USER
Group changes only apply to new logins, so log out and back in, or run newgrp docker to get a shell where the group is already active.
Keep in mind that membership in the docker group is effectively root access: anyone in it can start a container that mounts the entire file system. Only add users you’d also trust with sudo. If you want tighter isolation, Docker’s documentation covers rootless mode, where the Docker daemon itself runs without root.
Testing the Installation
docker run hello-world
Docker pulls a tiny test image, runs it and prints a message starting with “Hello from Docker!”. If you see it, Docker works. Getting “permission denied” instead means the group change hasn’t kicked in yet, so log out and back in as described above.
Checking the Version
docker --version
# Docker version 29.x.x, build ...
docker compose version
# Docker Compose version v5.x.x
The exact numbers depend on when you install. What matters is the major version: if docker --version shows 26 or lower, you’ve most likely ended up with the docker.io package from Raspberry Pi OS.
If your Pi is going to run around the clock, set up log rotation now. It only applies to containers created afterwards.
Essential Docker Commands
We’ll use the nginx web server as an example. -p 8080:80 forwards port 8080 on the Pi to port 80 inside the container. We’re keeping port 80 free because Pi-hole needs it further down.
# Download an image
docker pull nginx
# Start a container in the background, Pi port 8080 to container port 80
docker run -d -p 8080:80 --name my-nginx nginx
# List running containers
docker ps
# List all containers, including stopped ones
docker ps -a
# Stop and start a container
docker stop my-nginx
docker start my-nginx
# Show a container's logs
docker logs my-nginx
# Open a shell inside a running container
docker exec -it my-nginx bash
# Delete a container
docker rm -f my-nginx
# List downloaded images and delete one
docker images
docker rmi nginx
After the docker run, open http://PI-IP-ADDRESS:8080 in your browser to see the nginx welcome page. hostname -I shows your Pi’s IP address.
Volumes: Keeping Your Data
Anything an application stores inside its container disappears when you delete the container, which also happens with every update. To keep settings and data, put them in a volume: a folder on the Pi that Docker makes available inside the container. The tilde ~ is short for your home directory:
# Remove the test container from above if it's still running
docker rm -f my-nginx
mkdir -p ~/nginx-data
echo "Hello from the Raspberry Pi" > ~/nginx-data/index.html
docker run -d \
-p 8080:80 \
-v ~/nginx-data:/usr/share/nginx/html \
--name my-nginx \
nginx
http://PI-IP-ADDRESS:8080 now shows “Hello from the Raspberry Pi”. The file lives on the Pi and survives no matter how often you delete and recreate the container. If the folder is empty, nginx returns “403 Forbidden”.
Instead of a folder path, you can also give a name, such as -v portainer_data:/data. Docker then creates a named volume and manages it itself under /var/lib/docker/volumes. docker volume ls lists all named volumes.
Docker Compose
Docker Compose lets you describe one or more containers, with their ports, folders and settings, in a single text file and start everything with one command. You can back that file up, tweak it and take it to another machine. For almost any home server project it beats typing long docker run commands.
There’s nothing extra to install: both methods above include Compose as a plugin, which you call as docker compose (with a space). If docker compose version still reports an unknown command, add the plugin:
sudo apt install docker-compose-plugin
That package only exists in Docker’s repository; the Raspberry Pi OS repositories don’t have it. If apt can’t find it, Docker’s repository isn’t set up. Add it with the first two command blocks from Method 2, run sudo apt update and try again. The old hyphenated docker-compose is outdated and shouldn’t be used anymore.
Docker recommends naming the file compose.yaml. The older docker-compose.yml still works, and plenty of guides use it. If you’d rather not write the file by hand, put one together with our Docker Compose Generator.
Your First Stack: Pi-hole with Docker Compose
Pi-hole blocks ads for your entire home network: it answers your devices’ DNS lookups and refuses to resolve ad and tracking domains. It makes a good first Compose project because it only needs a single container. Create a project folder and open a new file in it:
mkdir ~/pihole && cd ~/pihole
nano compose.yaml
Paste the following, replacing the password with your own and the time zone with yours:
services:
pihole:
image: pihole/pihole:latest
container_name: pihole
ports:
- "53:53/tcp"
- "53:53/udp"
- "80:80/tcp"
- "443:443/tcp"
environment:
TZ: 'Europe/London'
FTLCONF_webserver_api_password: 'YOUR_PASSWORD'
FTLCONF_dns_listeningMode: 'ALL'
volumes:
- './etc-pihole:/etc/pihole'
restart: unless-stopped
Save with Ctrl+O, confirm with Enter and exit nano with Ctrl+X. Here’s what each part does:
- ports: port 53 receives DNS queries, 80 and 443 serve the web interface.
- FTLCONF_webserver_api_password: the password for the web interface.
- FTLCONF_dns_listeningMode: ‘ALL’: lets Pi-hole answer queries from your home network. Without it, Pi-hole inside Docker’s network only accepts queries from its immediate neighbors, and your devices would get no answer.
- volumes: settings, blocklists and statistics live in the
etc-piholesubfolder and survive updates. - restart: unless-stopped: Docker brings the container back after a crash or a reboot, unless you stopped it yourself.
WEBPASSWORD. That was Pi-hole 5. The current Pi-hole 6 ignores it (Pi-hole’s migration notes) and generates a random password instead, so logging in with yours fails. You’ll find the random one in the log (docker logs pihole). To fix such a file, replace WEBPASSWORD with FTLCONF_webserver_api_password and recreate the container with docker compose up -d.Start and stop the stack from inside the project folder:
# Start (in the background)
docker compose up -d
# Stop and remove the containers; your data in ./etc-pihole stays
docker compose down
The web interface is at http://PI-IP-ADDRESS/admin. For Pi-hole to start blocking ads, your devices have to use it as their DNS server. Our guide to setting up Pi-hole shows how to configure that on your router.

Besides unless-stopped, there’s restart: always, which brings the container back after a reboot even if you had stopped it manually. With docker run, the option is --restart unless-stopped. Without a restart policy, a container stays down after a reboot.
Running Home Assistant in a Container
💡 Tip: Running Home Assistant in a container is just one option. Our Home Assistant on Raspberry Pi hub helps you pick the setup that fits your smart home.
As a container, Home Assistant sits alongside your other services. The trade-off: you don’t get apps from the Home Assistant store (formerly add-ons), which are only available with Home Assistant OS. Our complete Home Assistant installation guide compares both approaches.
mkdir ~/homeassistant && cd ~/homeassistant
nano compose.yaml
Paste the following and save it as before with Ctrl+O and Ctrl+X:
services:
homeassistant:
image: ghcr.io/home-assistant/home-assistant:stable
container_name: homeassistant
volumes:
- ./config:/config
- /etc/localtime:/etc/localtime:ro
- /run/dbus:/run/dbus:ro
environment:
TZ: 'Europe/London'
restart: unless-stopped
stop_grace_period: 60s
privileged: true
network_mode: host
- ./config: the configuration goes into a
configsubfolder of your project folder, whatever your username is. - /run/dbus: Home Assistant talks to Bluetooth through this system service.
- network_mode: host: the container uses the Pi’s network directly. That’s the only way Home Assistant can automatically discover devices like Philips Hue, ESPHome boards or printers on your network.
- privileged: true: gives the container access to connected hardware such as Zigbee or Z-Wave sticks.
- stop_grace_period: 60s: when you stop a container, Docker forcibly ends it after 10 seconds by default. Home Assistant can need longer than that to close its database, and this line gives it up to 60 seconds.
Start Home Assistant from the project folder:
docker compose up -d
After a minute or two, Home Assistant is up at http://PI-IP-ADDRESS:8123. In a container it stays on port 8123. The move to port 80 in Home Assistant 2026.8 only affects new Home Assistant OS installations, as explained in Home Assistant without :8123.
Portainer: Managing Docker in Your Browser
Portainer is a web interface for Docker. You can see and control containers, images and volumes from your browser instead of the command line. Portainer itself runs as a container. Once it starts, you have five minutes to create the admin account in your browser:
docker volume create portainer_data
docker run -d \
-p 9443:9443 \
--name portainer \
--restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
portainer/portainer-ce:lts
Then open https://PI-IP-ADDRESS:9443. Your browser will warn you about the self-signed certificate, which is expected. Portainer asks for a username, a password of at least 12 characters and a setup token. To get the token, run this on your Pi:
docker logs portainer 2>&1 | grep setup_token
Copy the value after setup_token= into the “Setup token” field. If you miss the five-minute window, Portainer locks the setup for security reasons. Restart the container with docker restart portainer, grab the token from the log again and reload the page. Our Portainer guide covers the setup in detail, plus updates and stacks.

Useful Docker Containers for the Raspberry Pi
| Container | What it’s for |
|---|---|
| Portainer | Manage Docker in your browser |
| Pi-hole | Network-wide ad blocker |
| Home Assistant | Smart home hub |
| Nextcloud | Your own cloud for files, calendars and contacts |
| Vaultwarden | Password manager, Bitwarden-compatible |
| Nginx Proxy Manager | Reverse proxy with Let’s Encrypt certificates |
| Grafana + InfluxDB | Store sensor data and chart it |
Our Docker Compose Generator builds ready-to-use Compose files for several of these services. You’ll also find the files for Pi-hole, Home Assistant, Nextcloud and Ollama in our GitHub repository.
Tips for Running Docker 24/7
Setting Up Log Rotation
Docker keeps each container’s output in log files, and by default there’s no size limit. Over months, that can fill up your SD card or SSD. Set a limit for all containers in /etc/docker/daemon.json:
sudo nano /etc/docker/daemon.json
{
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "3"
}
}
sudo systemctl restart docker
Docker now keeps at most three 10 MB files per container. The setting only applies to containers created afterwards. Recreate existing Compose stacks with docker compose up -d --force-recreate in each project folder; the data in your volumes is kept. For containers you started with docker run, such as Portainer, delete them with docker rm -f NAME and start them again with the same command as before.
Freeing Up Space
# Show how much space Docker uses
docker system df
# Delete stopped containers, unused networks, unused images and the build cache
docker system prune -a
Old images pile up after every update, and on a small SD card you’ll notice quickly. docker system prune -a also deletes stopped containers along with their images. To bring a stopped Compose stack back, run docker compose up -d in its project folder and Docker downloads the images again. The data in your volumes is kept.
Use an SSD Instead of an SD Card
Docker writes to storage all the time: image layers, logs and the data in your volumes. For 24/7 use, that makes it worth booting the whole Pi from an SSD, such as a Samsung T7 on USB 3.0*, or on a Pi 5, an NVMe SSD on an M.2 HAT. Which SSD suits which model is covered in Boot Raspberry Pi from SSD.
Swap: When RAM Runs Low
With 1 or 2 GB of RAM, a few containers can fill up memory fast. Swap is overflow space where Linux parks data it rarely uses. Current Raspberry Pi OS sets it up for you through the rpi-swap package, as a compressed area in RAM (zram); on our 4 GB Pi 5 that’s 2 GB. To see what’s active:
sudo swapon --show
You can change the size and type of swap in /etc/rpi/swap.conf. The older dphys-swapfile tool isn’t installed there anymore, so guides that tell you to edit CONF_SWAPSIZE only apply to older installations. Our Raspberry Pi swap guide covers both.
Updating and Removing Docker
Both install methods add Docker’s repository, so Docker itself gets updated along with the rest of your system:
sudo apt update && sudo apt full-upgrade -y
The Docker service restarts during the update, and containers with a restart policy come back up on their own. The applications inside your containers are updated separately, from each stack’s project folder:
# Pull new images and recreate the containers with them
docker compose pull
docker compose up -d
# Remove old images that are no longer used
docker image prune
Containers you started with docker run, such as Portainer, take three steps: pull the new image with docker pull IMAGE, delete the container with docker rm -f NAME and start it again with the same docker run command as before. The data in its volumes is kept.
To uninstall Docker, remove the packages, then the data, and finally Docker’s repository and signing key. The second command permanently deletes all images, containers and Docker volumes. Folders you mounted yourself, like ~/pihole/etc-pihole, stay where they are, and so does any /etc/docker/daemon.json you created. If you used Method 2, apt reports that docker-model-plugin isn’t installed. That’s expected: only the script adds that package.
sudo apt purge -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras docker-model-plugin
sudo rm -rf /var/lib/docker /var/lib/containerd
sudo rm /etc/apt/sources.list.d/docker.list /etc/apt/keyrings/docker.asc
Common Problems and Fixes
“permission denied” When Running Docker
Your user isn’t in the docker group yet, or the group isn’t active in your current session:
sudo usermod -aG docker $USER
# then log out and back in, or:
newgrp docker
The Container Runs but You Can’t Reach It
Work through these checks:
docker pslists the forwarded ports in the PORTS column. If nothing’s there, the-poption or theports:section is missing.docker logs NAMEtells you whether the application inside the container actually started.sudo ss -tulpnlists every port in use. A container won’t start if another service already holds its port.
Raspberry Pi OS doesn’t run a firewall out of the box. If you’ve installed ufw yourself, be aware that Docker adds its own firewall rules for published ports, and they take effect before ufw’s (Docker’s notes on ufw). A port published with -p is therefore reachable from your network even if ufw is supposed to block it. To keep a service reachable only from the Pi itself, bind it to the local address, for example -p 127.0.0.1:8080:80.
“no space left on device”
Old images, stopped containers and the build cache are taking up space. docker system df shows where it went, and docker system prune -a cleans up (see Freeing Up Space). Adding --volumes also deletes anonymous volumes no container is currently using; named volumes such as portainer_data stay. Only add it when you’re sure those volumes hold nothing you still need.
“no matching manifest” on 32-bit Systems
The image isn’t available for 32-bit ARM (linux/arm/v7), which is now the case for many images. The only fix is switching to 64-bit Raspberry Pi OS.
Raspberry Pi 5: “Unsupported system page size”
The Pi 5 kernel uses 16 KB memory pages instead of the usual 4 KB. That’s faster, but some software can’t handle it, especially programs built with the jemalloc memory allocator. Their containers crash right away on a Pi 5 with this or a similar error, while they run fine on a Pi 4. getconf PAGESIZE tells you which page size your system uses; 16384 means 16 KB.
According to the Raspberry Pi documentation, adding kernel=kernel8.img to /boot/firmware/config.txt makes the Pi 5 boot a kernel with 4 KB pages after a reboot. Those images then run, at the cost of a little performance across the whole system. A different image or version is often the better way out. The official InfluxDB 3 images are a case in point: they won’t start on a Pi 5, while InfluxDB 1.x runs fine. Home Assistant and InfluxDB has the details.
Frequently Asked Questions About Docker on the Raspberry Pi
Docker runs on the Raspberry Pi 3, 4 and 5 and the Zero 2 W. Use a 64-bit operating system such as 64-bit Raspberry Pi OS, since many images aren’t available for 32-bit ARM. The Zero 2 W only has 512 MB of RAM, enough for one or two very light containers. There are no official Docker packages for the Raspberry Pi 1, Zero and Zero W anymore.
From Docker, either with the get.docker.com install script or through Docker’s APT repository. The docker.io package in Raspberry Pi OS is several releases behind (26.1 instead of 29) and doesn’t include a current Docker Compose.
Docker is the runtime that starts individual containers. Docker Compose describes one or more related containers in a file called compose.yaml and starts them all with a single command. For almost any home server project, Compose is the more convenient choice.
It depends on your RAM and on the services you run, so there’s no fixed number. free -m shows how much memory is left in the available column. Run it before and after starting a container to see roughly how much that container uses.
Docker itself updates with your regular system update, sudo apt update followed by sudo apt full-upgrade, because both install methods add Docker’s repository. Don’t rerun the install script for this. The applications in your containers are updated separately with docker compose pull and docker compose up -d.
Only if they have a restart policy. With restart: unless-stopped in compose.yaml, or --restart unless-stopped with docker run, Docker restarts the container after every reboot unless you stopped it yourself. Both install methods already enable the Docker service itself at boot.
Docker writes a lot to storage, including logs, image layers and data. Log rotation in /etc/docker/daemon.json keeps the logs in check. For 24/7 use, go with a USB or NVMe SSD as your system drive.
Containers aren’t virtual machines but processes that share the Pi’s Linux kernel, so there’s no second operating system running alongside. On top of that, you get clean updates and no conflicts between services.
Pull the new image and recreate the container — with Compose: docker compose pull followed by docker compose up -d. Your data is preserved as long as it lives in volumes or mapped folders, as usual, and not inside the container itself.
Have fun with your first containers!
