Why Docker on Raspberry Pi?
Docker revolutionizes how you deploy and manage applications on Raspberry Pi. Run multiple isolated services, easily update software, and keep your system clean.
Docker Benefits on Pi
- Isolation: Each app runs in its own container
- Easy updates: Pull new image, restart container
- Clean system: No dependency conflicts
- Reproducible: docker-compose.yml defines everything
- Portability: Move containers between devices
Requirements
| Requirement | Minimum | Recommended |
|---|---|---|
| Raspberry Pi | Pi 3B+ (armhf) | Pi 4/5 (arm64) |
| RAM | 2GB | 4GB+ |
| Storage | 16GB SD | 32GB+ SSD |
| OS | Raspberry Pi OS | 64-bit Bookworm |
Installing Docker
The official Docker install script handles everything automatically:
# Update system first
sudo apt update && sudo apt upgrade -y
# Install Docker using official script
curl -fsSL https://get.docker.com | sh
# Add your user to docker group (no sudo needed)
sudo usermod -aG docker $USER
# Log out and back in, then verify
docker --version
docker run hello-world
Docker Compose
Docker Compose lets you define multi-container applications in a single YAML file:
# Install Docker Compose plugin
sudo apt install docker-compose-plugin
# Verify installation
docker compose version
Example: Home Assistant Stack
Here's a complete docker-compose.yml for a home automation stack:
version: "3.8"
services:
homeassistant:
image: homeassistant/home-assistant:stable
container_name: homeassistant
volumes:
- ./homeassistant:/config
environment:
- TZ=Europe/Rome
restart: unless-stopped
network_mode: host
mosquitto:
image: eclipse-mosquitto:latest
container_name: mosquitto
volumes:
- ./mosquitto:/mosquitto
ports:
- "1883:1883"
restart: unless-stopped
portainer:
image: portainer/portainer-ce:latest
container_name: portainer
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./portainer:/data
ports:
- "9000:9000"
restart: unless-stopped
Usage
# Start all services
docker compose up -d
# View logs
docker compose logs -f
# Stop all services
docker compose down
Popular Docker Containers for Pi
Home Assistant
Smart home automation hub
Pi-hole
Network-wide ad blocking DNS
Grafana + InfluxDB
Metrics visualization dashboards
Jellyfin/Plex
Media server streaming
Nginx Proxy Manager
Reverse proxy with SSL
Node-RED
Visual IoT programming
Essential Docker Commands
| Command | Description |
|---|---|
docker ps | List running containers |
docker ps -a | List all containers |
docker images | List downloaded images |
docker logs [name] | View container logs |
docker exec -it [name] bash | Shell into container |
docker system prune | Clean unused resources |
Raspberry Pi for Docker
Browse our Raspberry Pi collection - Pi 4 and Pi 5 are ideal for Docker workloads.
Compare models in our Raspberry Pi 5 vs 4 Guide.
Frequently Asked Questions
Can Raspberry Pi run Docker efficiently?
Yes, Raspberry Pi 4 and 5 run Docker very efficiently. With 4-8GB RAM, you can run multiple containers simultaneously. Docker's lightweight containerization uses far fewer resources than virtual machines. Use Pi 5 for the best performance with demanding multi-container stacks.
Will all Docker images work on Raspberry Pi?
No, only ARM-compatible images work on Raspberry Pi. Look for images supporting arm64 (for 64-bit OS) or armv7 (for 32-bit OS). Many official images like nginx, node, python, and mysql support multi-architecture and work automatically. Check image documentation for ARM support.
Should I use Docker or install applications directly on Raspberry Pi?
Docker is recommended for most applications because it provides isolation, easy updates, and portability. Direct installation may be better for GPIO-intensive applications or when you need maximum performance. For servers, development, and learning, Docker offers significant advantages.
How much storage do I need for Docker on Raspberry Pi?
Start with 32GB minimum, but 64GB+ is recommended. Each image is 100MB-1GB typically. Docker system files, logs, and volumes consume significant space over time. Use external SSD for better performance and capacity. Run 'docker system df' to monitor usage.
Can I run Docker Compose on Raspberry Pi?
Yes, Docker Compose works perfectly on Raspberry Pi and is the recommended way to manage multi-container applications. Install via apt (docker-compose-plugin) or pip. Most docker-compose.yml files from x86 systems work on Pi if images support ARM architecture.
