Home Assistant with Docker on Raspberry Pi: the 2026 guide
Tim Kleyersburg · · 7 minutes to read
Updated in November 2026: new image, new Docker install steps and a Compose file without a version key, because most of the 2024 version had quietly gone out of date.
Finally, a Raspberry Pi 4 with 8GB RAM came into stock that wasn’t outrageously priced.
Quick tip: remember where you’ve placed your Micro SD card from your last bricked Pi so you don’t have to wait for the delivery of a new one.
I’m assuming you have basic knowledge of Linux (for example, how to connect to another computer with SSH), so forgive me if I don’t explain everything down to the last detail. Don’t hesitate to message me on X if you have any questions.
#Container or Home Assistant OS?
Before you start, decide which installation you actually want. Home Assistant recommends Home Assistant Operating System for most users. It includes the Home Assistant Supervisor, which keeps the system up to date, and it supports apps (the glossary says these were formerly called add-ons).
This guide sets up Home Assistant Container. You bring your own operating system and Docker, you handle updates yourself, and you don’t get apps. Some integrations, such as Thread and Z-Wave, are controlled by apps, so Container has no out-of-the-box support for them.
If you just want a working smart home, flash Home Assistant OS onto your Pi and skip this post. The Container route makes sense if you want Home Assistant next to other containers on a Linux system you manage yourself.
For the Container install, the official docs list a Raspberry Pi 3, 4 or 5 as hardware. For Home Assistant OS on a Pi they ask for a Raspberry Pi 4 or 5 with at least 2 GB of RAM.
#The guide
We’ll follow these steps to get a working installation of Home Assistant running on your local network:
- Install Raspberry Pi OS with Raspberry Pi Imager.
- Connect to and update your Raspberry Pi.
- Install Docker.
- Run Home Assistant as a Docker container.
#1. Install Raspberry Pi OS with Raspberry Pi Imager
While I’m not typically a fan of installers, preferring to understand what’s happening during each step, I highly recommend using the Imager tool for installing Raspberry Pi OS on your SD card in this instance. It saves time and prevents headaches during the initial configuration.
Download Raspberry Pi Imager for your operating system. Imager now walks you through a few tabs instead of the old settings cog:
- In the Device tab, select your Raspberry Pi model.
- In the OS tab, choose Raspberry Pi OS Lite (64-bit). Lite has no desktop, which is all a headless Home Assistant box needs. The 64-bit part matters: Docker Engine v28 was the last major version with packages for 32-bit Raspberry Pi OS. The current Raspberry Pi OS is based on Debian 13 (Trixie).
- Insert your SD card into your computer and select it in the Storage tab. Keep “Exclude system drives” selected so you can’t wipe your own disk by accident.
- In the Customisation tab, set up the installation.
I customised a few things:
- Set the hostname to rpi for brevity.
- Set time zone and keyboard layout under Localisation. Imager fills both in from the capital city you pick.
- Created a user with a password.
- Configured Wi-Fi with my network details. I plan to hardwire the Pi eventually, but avoiding cables made setup easier.
- Enabled SSH under Remote Access with public key authentication. If you already have a public key, Imager uses it.
The last tab shows a summary. Select Write and confirm with “I understand, erase and write”. Writing and verifying the image may take a few minutes depending on the speed of your card.
Once complete, insert the card into your Raspberry Pi and continue.
#2. Connecting and updating your Raspberry Pi
After inserting the SD card, power up your Pi by connecting the power supply. Allow it 1 or 2 minutes to fully boot.
You can then connect using your preferred terminal:
ssh [email protected]
Change the username (pi) and hostname (rpi) to what you set in the Customisation tab. Alternatively, use the IP address assigned by your router.
To update packages and upgrade your Pi to the latest version, run:
sudo apt update && sudo apt full-upgrade
A full upgrade also updates the Linux kernel and firmware, so reboot before you continue:
sudo reboot
Your Pi will reboot, ready for the next step.
#3. Installing Docker
Earlier versions of this guide used Docker’s convenience script. Docker’s documentation recommends that script only for testing and development environments. For the 64-bit Raspberry Pi OS it points you to the Debian instructions, so that’s what we use. Home Assistant also needs Docker Engine 23.0.0 or later, and Docker’s own repository gives you a current version.
First, add Docker’s apt repository:
# Add Docker's official GPG key:
sudo apt update
sudo apt install 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
# Add the repository to Apt sources:
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/debian
Suites: $(. /etc/os-release && echo "$VERSION_CODENAME")
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF
sudo apt update
Then install Docker Engine and the Compose plugin:
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Check that it works:
sudo docker run hello-world
By default, non-root users don’t have rights to run containers, so we’ll add our current user to the docker group. That removes the need for sudo every time we want to run a container.
sudo usermod -aG docker ${USER}
Log out and back in so the new group membership applies. Run groups ${USER} to verify that this has worked. You should see docker at the end of the line.
Be aware that membership in the docker group grants root-level privileges, so only add users you trust.
The old guide also told you to enable the Docker system service. According to Docker’s docs, the service starts on boot by default on Debian, which Raspberry Pi OS is based on, so you can skip that. Docker then also starts containers that use a restart policy of always or unless-stopped. We’ll configure our Home Assistant container that way.
#4. Running Home Assistant as Docker container
Finally, we’re at the stage of running Home Assistant in a Docker container accessible from your local network.
Create a file called compose.yaml in a folder called docker/homeAssistant within your home folder, resulting in this structure:
pi@rpi:~ $ tree -L 3
.
└── docker
└── homeAssistant
└── compose.yaml
2 directories, 1 file
compose.yaml is now the preferred file name. Compose still reads docker-compose.yml for backwards compatibility, so an older setup keeps working.
Put the following into compose.yaml. It follows the official Home Assistant Container instructions. You’ll likely need to change the timezone to match yours.
services:
homeassistant:
container_name: homeassistant
image: ghcr.io/home-assistant/home-assistant:stable
volumes:
- ./config:/config
- /etc/localtime:/etc/localtime:ro
- /run/dbus:/run/dbus:ro
restart: unless-stopped
stop_grace_period: 60s
privileged: true
network_mode: host
environment:
TZ: Europe/Berlin
What changed compared to the old file:
- There is no
version:line anymore. Compose ignores the top-levelversionelement and warns that it is obsolete. - The image is the official
ghcr.io/home-assistant/home-assistant:stableinstead of the linuxserver.io image, soPUIDandPGIDare gone. ./configis a relative path. Compose resolves it from the folder that containscompose.yaml, so your configuration ends up in~/docker/homeAssistant/config./run/dbusis optional, but the Bluetooth integration needs it.stop_grace_period: 60sgives Home Assistant time to close its database. Docker’s default is 10 seconds, and if Home Assistant gets stopped before it finishes, the next start logs warnings about an unclean shutdown.
The restart: unless-stopped option restarts the container after a reboot of your Pi, unless you’ve stopped it manually.
If you use a Zigbee USB stick or another device an integration needs direct access to, map it into the container. Adjust the path to your device:
services:
homeassistant:
# ...
devices:
- /dev/ttyUSB0:/dev/ttyUSB0
In theory, you’re now ready to start your container and begin configuring Home Assistant.
From the directory ~/docker/homeAssistant, run:
docker compose up -d
Note that it’s docker compose with a space now. The old docker-compose with a hyphen belongs to Compose v1. The -d flag runs the container in detached mode in the background.
If you see no errors appear, congratulations! Access Home Assistant by navigating to http://rpi.local:8123 (adjust the URL if your hostname is different). You can now start the onboarding process; for this, I highly recommend referring to the official documentation.
#Updating Home Assistant
On Home Assistant OS, the Supervisor handles updates. Here it’s your job, but it only takes two commands. From the same directory, run:
docker compose pull
docker compose up -d
pull downloads the newest stable image while your current container keeps running. up -d notices that the image changed and recreates the container. Your mounted config folder stays as it is. I’ve written a separate post about updating if you want more detail.