Run Home Assistant in Docker
Nghia Phan
Table of Contents
Home Assistant is an open-source home automation platform that works well on a Linux server or HomeLab. This article adapts the Docker-based setup and stores the application configuration in a dedicated directory.
Source reference: i12bretro – Running Home Assistant in Docker. The original video belongs to i12bretro on YouTube.
Install Docker on Linux
On the Linux host, run the following commands to install Docker:
sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg-agent -ycurl -fsSL https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release)/gpg | sudo apt-key add -sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release) $(lsb_release -cs) stable"sudo apt install docker-ce docker-compose containerd.io -ysudo systemctl enable docker && sudo systemctl start dockersudo usermod -aG docker $USERsu - $USER
Run the Home Assistant container
- Create a directory for the configuration:
mkdir ~/docker/home-assistant -psudo chown "$USER":"$USER" ~/docker -R
- Run the container. Change
TZto the actual local timezone if needed:
docker run -d --name home-assistant \ --privileged \ -e TZ=Asia/Ho_Chi_Minh \ -v ~/docker/home-assistant:/config \ --network=host \ --restart=unless-stopped \ homeassistant/home-assistant
- Check the container with
docker psand wait for the first initialization. - Open
http://DNSorIP:8123/. - Create the administrator Name, Username, and Password.
- Name the installation, for example
Home. - Click Detect to set the location.
- Verify the Unit System and Currency, then click Next.
- Select any anonymous data to share with the Home Assistant development team.
- Click Finish to open the main interface.
Quảng cáo
Note:
--network=hostgives Home Assistant direct access to the host network namespace, which can help with device discovery but also increases the container’s network scope. Use it only on a host you control and protect the Web UI with a trusted network or an appropriate reverse proxy.
Source and video
- Original tutorial: i12bretro 0672
- Original video: Running Home Assistant in Docker
- Home Assistant: home-assistant.io
- Container guide: Home Assistant Container
Comments & Discussion
Share your thoughts, ask questions and feedback