Howto install Home Assistant inside Docker

Homeassistant docker login page

In this how-to, we will walk you through the installation of Home Assistant in Docker. Home Assistant is particularly well-suited to run in a Docker environment. By using tools like Watchtower, you can always ensure that you have the latest version running on your network!

Let’s get started!

First, Docker needs to be installed. You can find instructions on how to do this on my blog.

To start Home Assistant, we will create a Docker Compose file. Below is my example:

---
services:
home-assistant:
image: ghcr.io/home-assistant/home-assistant:stable
container_name: home-assistant
environment:
- TZ=Europe/Amsterdam
volumes:
- /opt/containers/home-assistant:/config
devices:
- /dev/ttyACM0:/dev/ttyACM0
network_mode: host
restart: unless-stopped

The line:

volumes:
- ./config:/config

specifies the directory we are mounting to the container. In this case, we are mounting /opt/containers/home-assistant to /config within the container.

Additionally, I have passed a USB device to the container using the following JSON line:

devices:
- /dev/ttyACM0:/dev/ttyACM0

You could further customize the container using ENV options, but in my case, this wasn’t necessary.

Save the file above as docker-compose.yml in a directory that also contains the necessary directory for the mount. Then, within this directory, run the following command to start the Docker container:

docker compose up -d

The container should now be up and running, accessible at https://<ip>:8123.

Enjoy setting up and configuring Home Assistant!

Leave a Reply

Your email address will not be published. Required fields are marked *