Running Home Assistant on Fedora with Docker

Home Assistant is a really great, open source home automation platform written in Python which supports hundreds of components. They have a containerised version called Hass.io which can run on a bunch of hardware and has a built-in marketplace to make the running of addons (like Let’s Encrypt) easy.

I’ve been running Home Assistant on a Raspberry Pi for a couple of years, but I want something that’s more poweful and where I have more control. Here’s how you can use the official Home Assistant containers on Fedora (note that this does not include their Hass.io marketplace).

First, install Fedora Server edition, which comes with the handy web UI for managing the system called Cockpit.

Once you’re up and running, install Docker and the Cockpit plugin.

sudo dnf install -y docker cockpit-docker

Now we can start and enable the Docker daemon and restart cockpit to load the Docker plugin.

sudo systemctl start docker && sudo systemctl enable docker
sudo systemctl restart cockpit

Create a location for the Home Assistant configuration and set the appropriate SELinux context. This lets you modify the configuration directly from the host and restart the container to pick up the change.

sudo mkdir -p /hass/config
sudo chcon -Rt svirt_sandbox_file_t /hass

Start up a container called hass using the Home Assistant Docker image which will start automatically thanks to the restart option. We pass through the /hass/config directory on the host as /config inside the container.

docker run --init -d \
--restart unless-stopped \
--name="hass" \
-v /hass/config/:/config \
-v /etc/localtime:/etc/localtime:ro \
--net=host \
homeassistant/home-assistant

You should be able to see the container starting up.

sudo docker ps

If you need to, you can get the logs for the container.

sudo docker logs hass

Once it’s started you should see port 8123 listening on the host

sudo ss -ltnp |grep 8123

Finally, enable port 8123 on the firewall to access the service on your network.

sudo firewall-cmd --zone=FedoraServer --add-port=8123/tcp
sudo firewall-cmd --runtime-to-permanent

Now browse to the IP address of your server on port 8123 and you should see Home Assistant. Create an account to get started!

2 thoughts on “Running Home Assistant on Fedora with Docker

  1. Hi
    I followed your guide and successful got home assistant working in docker. After a reboot I failed to access home assistant I believe the issue is I did not properly enabled the firewall rule. What is meant by zone=FedoraServer?

  2. Firewalld adds rules into “zones” and network interfaces are added to those zones. You need to make sure that the zones match what’s on your machine and that your interface is in that zone. However, you said that it was working before you rebooted which means it’s likely that the rules were working. Did you make sure that you ran the command which makes them permanent?

    sudo firewall-cmd --runtime-to-permanent

    Did you check that the docker container is running after a reboot?

    sudo docker ps

    And that the container is listening on the right port?

    sudo ss -ltnp |grep 8123

    You can also check that the firewall has port 8123 open:

    sudo iptables -L -n |grep 8123

Leave a Reply

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