Complete Home Assistant Docker Stack on Raspberry Pi 4
After weeks of research and configuration, I have been running a complete self-hosted smart home stack on a Raspberry Pi 4 for over 7 weeks. Here is everything that is running and the lessons learned along the way.
The Stack
All services run in Docker on a single RPi 4 (4GB RAM) with a 500GB USB SSD.
| Service | Purpose |
|---|---|
| Home Assistant | Smart home hub – 40+ devices |
| Frigate NVR | AI camera detection, no cloud |
| ESPHome | DIY ESP32 sensor management |
| Mosquitto | MQTT broker |
| Prometheus | Metrics collection |
| Node Exporter | RPi system metrics |
| Grafana | Monitoring dashboards |
| Speedtest Exporter | Internet speed tracking |
| Cloudflare Tunnel | Remote access, no port forwarding |
| Immich | Self-hosted photo backup |
| BookStack | Documentation wiki |
Why Docker Instead of Home Assistant OS
The official recommendation is to use Home Assistant OS (HAOS) which gives you the supervisor and add-on store. That is a valid approach.
I chose Docker because I wanted everything in a single docker-compose.yml file – easier to backup, update, and migrate. The trade-off is that you configure everything manually, without the add-on store.
Key Lessons Learned
Use a USB SSD, Not a MicroSD Card
Running Docker volumes on a microSD card causes premature failure within months due to constant read/write. A 120GB USB SSD costs around €15–20 and will last for years. This is not optional for a production setup.
Pin Your Docker Image Versions
The grafana:latest tag pulled Grafana 12, which causes 100%+ CPU usage on ARM/RPi due to a new internal API server. Always pin to tested versions:
image: grafana/grafana:10.4.3 # not latest
Cloudflare Tunnel Over Port Forwarding
Remote access without exposing your home IP or opening ports on your router. Works even behind CGNAT. Free. Takes 15 minutes to set up.
cAdvisor on a Loaded RPi
cAdvisor for Docker container monitoring consumed 115% CPU on my RPi with 15+ containers, even with aggressive settings. Load dropped from 7.0 to 1.0 after removing it. For container monitoring on a loaded RPi, skip cAdvisor and use Home Assistant rest sensors for uptime monitoring instead.
Resource Usage
With the full stack running:
- CPU: 5–15% idle
- RAM: ~2.0 GB used of 3.7 GB
- Load average: 0.8–1.5
Getting Started
If you want to skip the research phase and deploy this stack with everything pre-configured, I put together a complete package with the docker-compose.yml, all config files, and a step-by-step setup guide:
👉 Home Assistant Complete Stack on Gumroad
It includes the full stack deployment guide (PDF), pre-configured config files for Frigate, Prometheus, Mosquitto, and ESPHome templates for adding your own sensors.
Questions? Feel free to reach out via the contact page or find me on Reddit as u/damian2609.