How to Set Up Home Assistant Using Docker

Run Home Assistant in Docker using Docker Compose. Covers the Compose file, host networking requirement, persistent config volumes, and accessing the dashboard.

2 min read388 wordsDockerIndex
home assistantdockerhome automationdocker compose

Home Assistant is an open-source home automation platform that lets you control smart home devices locally, without cloud dependency. Running it in Docker is the easiest way to get started — it keeps Home Assistant isolated from your system and makes updates trivial.

Prerequisites

  • Docker and Docker Compose installed
  • A persistent storage location for configuration (e.g., /dkr/homeassistant/config)

Docker Compose Setup

Create a homeassistant.yml file:

version: "3"
services:
  homeassistant:
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    volumes:
      - /dkr/homeassistant/config:/config
      - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped
    privileged: true
    network_mode: host

Key settings explained:

  • network_mode: host — required for Home Assistant to discover devices on your local network (mDNS, Zigbee, Bluetooth, etc.). Without this, device auto-discovery won't work.
  • privileged: true — needed to access USB devices (Zigbee sticks, Z-Wave adapters) and certain hardware integrations.
  • /dkr/homeassistant/config:/config — maps a directory on your host to the container's config folder. All your configuration, automations, and integrations are stored here and persist across container restarts and upgrades.
  • /etc/localtime:/etc/localtime:ro — ensures the container uses your host's timezone for accurate automation scheduling.

Create the Config Directory

sudo mkdir -p /dkr/homeassistant/config

Deploy

docker compose -f homeassistant.yml up -d

This pulls the latest stable image and starts Home Assistant in the background.

Access the Dashboard

Open your browser and navigate to:

http://<your-server-ip>:8123

The first time you access it, Home Assistant runs an onboarding wizard where you:

  1. Create an admin account
  2. Set your location (for weather and sun-based automations)
  3. Approve any devices auto-discovered on your network

Checking Logs

docker logs homeassistant -f

Updating Home Assistant

docker compose -f homeassistant.yml pull
docker compose -f homeassistant.yml up -d

Docker pulls the new stable image and restarts the container. Your configuration in /dkr/homeassistant/config is untouched.

Backing Up Your Configuration

Your entire Home Assistant setup lives in the config directory:

sudo tar -czf homeassistant-backup-$(date +%Y%m%d).tar.gz /dkr/homeassistant/config

Home Assistant also has a built-in backup feature under Settings → System → Backups.

Conclusion

Home Assistant in Docker gives you a reliable, easily maintainable smart home hub. The key detail is network_mode: host — without it, local device discovery won't work. Once running, the Home Assistant integrations catalog covers thousands of devices and services you can connect to your dashboard.