What a nice headline, right? 😅 One day, I thought I’d give Home Assistant a try! And obviously, I couldn’t just make things easy and run it in a Linux virtual machine or my Raspberry Pi – instead, obviously I decided to run it on Windows 10! And obviously, I’d use Docker for it. And of course, not just Docker, but docker-compose.
Whatever that is. I don’t know – it’s the first time I’m trying out Docker. Or Home Assistant! Another learning experience coming in, am I right? 😁
Anyway, just as usual, let me document the pitfalls I run into – so that you won’t need to!
Tips on getting Home Assistant running on Docker on Windows 10
My tips for getting this stuff up and running.
Docker has a strict version requirement on Windows 10 – and not all hardware work on recent enough operating system versions!
I grabbed an old laptop to serve as my Docker host. That was my first mistake.
Since Docker requires Windows 10 version that supports Hyper-V and Containers features – they’ve been supported on Windows 10 Home 2004, and build 16299 on Windows 10 Pro, Enterprise and Education (“Fall Creators Update”, October 2017).
Apparently, a HP machine from 2011 can’t handle Windows 10 Home 2004. But it COULD handle a 2017 version of Windows 10 Enterprise! After an upgrade, I was good to do!
Note: Check out the requirements for your Windows Operating System.
Home Assistant on Docker on Windows 10 requires:
- Windows 10 Home 2004 or
- Windows 10 Pro, Enterprise or Education build 16299 (“Fall Creators Update”, October 2017)
Beware of the Network_mode!
If I knew how to read, I would’ve known this one, because it was in fact documented. When you’re creating your docker-compose.yml file, you should be following a guide like this.
Now, at the top of the page, it’ll say this:
You need to ignore this, because on Windows you can’t use “host” network mode. It’s not available. On a side note, I think it’s because Windows is so much more secure than macOS or Linux… Right? 😉
It actually says in the Windows-section:
Host networking is not supported on Windows so we have to forward the port 8123. This will let you access your Home Assistant portal from
http://localhost:8123, and if you forward port 8123 on your router to your machine IP, the traffic will be forwarded on through to the Docker container.
Anyway, here’s my docker-compose.yml file:
version: '3' services: homeassistant: container_name: home-assistant image: homeassistant/home-assistant:stable #network_mode: host # This won't work on Windows... volumes: - C:/Path/To/Your/HomeAssistantConfiguration/HomeAssistant:/config # Shares the configuration directory environment: - TZ=Europe/Helsinki # https://en.wikipedia.org/wiki/List_of_tz_database_time_zones restart: always ports: - 8123:8123 # this is the important part!
Note: Using a explicitly defined port, you might break run into issues. Or not. The documentation is kind of murky, but there are some older conversations describing issues with Multicast and device discovery. So.. Beware, I suppose, but I don’t yet know of another way to get this working.
Use OneDrive to version your configuration and Home Assistant files!
Ah – not sure if this will cause side effects down the line. But so far, so good!
You don’t need to do this. But since you will be maintaining the Home Assistant files from a folder in the host system mounted to the container, and you might need to make some changes to those files, you will need to version control or back them up somehow.
Since I’m lazy, and don’t know of any downsides, this is what I did:
The first folder contains the docker-compose.yml (and is used as the configuration when running docker-compose on the host), and the second folder contains the Home Assistant files.
Firewall will block you from accessing Home Assistant outside host
If you want to access Home Assistant from outside the host (and you probably do), you need to open your Windows Defender Firewall and whip up a new rule allowing inbound traffic to port 8123 using TCP.
I haven’t yet exposed my installation to outside world – that’ll probably require a whole another post in itself.
Things you should probably install on Home Assistant
In this section, I’ll document things I’ve found that probably will benefit any Home Assistant installation.
This is by no means an exhaustive list – I’ll update it as need be.
Okay, that’s really short for now. Sorry.
Anyway, that’s all I had for now! Look forward for updates to this post :)
- Pulumi task on Azure DevOps fails with error “azureblob.OpenBucket: accountName is required” - November 24, 2020
- Hacktoberfest 2020 - November 17, 2020
- How to access the site collection app catalog in SharePoint? - November 11, 2020