SmartHome
🌐 VI • ENRun Home Assistant in Docker
TABLE OF CONTENTS (Nhấn để xem)
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 -y
curl -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 -y
sudo systemctl enable docker && sudo systemctl start docker
sudo usermod -aG docker $USER
su - $USER
Run the Home Assistant container
- Create a directory for the configuration:
mkdir ~/docker/home-assistant -p
sudo 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.
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
Discussion & Feedback 0
Share your questions, feedback or insights with the community