3 minutes
Home Assistant Container Part 2: Home Assistant Container
Intro ¶
We’re continuing where we left off after Part 1: Install Debian, Docker and Portainer.
In this Part 2, we’ll setup our basic Home Assistant Container using docker-compose
.
Install Home Assistant Container ¶
docker-compose.yaml ¶
This part of our setup is actually fairly easy.
As far as docker-compose
goes, all we need to do is follow the HA Container documentation.
On our Docker machine, we add a config entry for Home Assistant Container in our docker-compose.yaml
.
Add this below the services:
key and watch out for indentation.
cd /opt
sudo nano docker-compose.yaml # or file editor of choice
# Edit file, see below
# Save and Close via Ctrl+O and Ctrl+X
version: '3.0'
services:
[...]
homeassistant:
container_name: homeassistant
image: "ghcr.io/home-assistant/home-assistant:stable"
restart: unless-stopped
environment:
- TZ=Europe/Brussels
volumes:
- /opt/homeassistant/config:/config
- /etc/localtime:/etc/localtime:ro
privileged: true
network_mode: host
Check config ¶
No errors or warnings :)
docker-compose -f docker-compose.yaml config
name: opt
services:
homeassistant:
container_name: homeassistant
environment:
TZ: Europe/Brussels
image: ghcr.io/home-assistant/home-assistant:stable
network_mode: host
privileged: true
restart: unless-stopped
volumes:
- type: bind
source: /opt/homeassistant/config
target: /config
bind:
create_host_path: true
- type: bind
source: /etc/localtime
target: /etc/localtime
read_only: true
bind:
create_host_path: true
portainer:
container_name: portainer
environment:
TZ: Europe/Brussels
image: portainer/portainer-ce
networks:
default: null
ports:
- mode: ingress
target: 9000
published: "9000"
protocol: tcp
restart: unless-stopped
stdin_open: true
tty: true
volumes:
- type: bind
source: /etc/localtime
target: /etc/localtime
read_only: true
bind:
create_host_path: true
- type: bind
source: /var/run/docker.sock
target: /var/run/docker.sock
bind:
create_host_path: true
- type: bind
source: /opt/portainer/data
target: /data
bind:
create_host_path: true
networks:
default:
name: opt_default
Launch container ¶
All that’s left to do is create the config directory we mentioned in the config and run docker-compose
.
cd /opt
sudo mkdir -p homeassistant/config
docker-compose up -d
Docker will now pull the Home Assistant image and will set everything up. I hope you have a coffee or tea nearby, as this may take a while…

Set up Home Assistant ¶
Now that the container is up and running, we still need to set up our Home Assistant instance itself.
Open a browser and go to http://<ip.of.our.box>:8123
.

Pick a username and password for your Home Assistant account. This account will also be the “admin”.
Next, go through setting up your Home Zone and what data you’re willing to share with Nabu Casa to improve Home Assistant. During the setup process, Home Assistant will even show you devices it has already discovered and which you can integrate from the get-go.
Once the setup is done, you end up at your Home Assistant Dashboard. If you configured any devices in the previous step, they will be displayed on the dashboard.

Finishing thoughts ¶
In Part 1 I mentioned I may be adding containers for MariaDB and InfluxDB. I didn’t cover this yet in this episode but I will in a future post, so keep an eye out ;)