How to install Home Assistant within an LXC container

I have published this blog post to help anyone having issues installing Home Assistant (and Docker) in an LXC container running on Ubuntu.

When I was installing Home Assistant on my own hardware, I could not find any straight-forward guides detailing how to do this, and Home Assistant’s own documentation does not help with installing in an LXC container.

NOTE: As of 18/06/2020 This install method now uses the ‘Supervised installer‘. Discussion regarding deprecation on this method is continuing on GitHub and Home Assistant’s website.


Step 1 – Create your LXC container

If you have not already done so, create a LXC container in the same way you normally do, if you already have done this, skip to Step 2.

In this example my container storage is run on ZFS. You must ensure you have at least 36GB of storage space available.

Following these instructions, replace lxd-homeassistant with your own container name if you wish.

Create a new container:

sudo lxc launch ubuntu:18.04 lxd-homeassistant

You can set CPU and Memory limits using the following commands:

For CPU:

sudo lxc config set lxd-homeassistant limits.cpu 1

For Memory:

sudo lxc config set lxd-homeassistant limits.memory 1024MB

You can also set Hard Drive size limits with ZFS. To limit the hard drive space of a container.

Note: ‘zfs’ is the ZFS name and ‘zpool’ and ‘containers’ are the pool names, the path can be found
using: sudo zfs list

sudo zfs set quota=36G zfs/zpool/containers/lxd-homeassistant


Step 2 – Give your container specific privileges

Setup container privileges:

sudo lxc config set lxd-homeassistant security.nesting true
sudo lxc config set lxd-homeassistant security.privileged true

Now run each of these lines separately:

cat <<EOT | sudo -
lxc config set lxd-homeassistant raw.lxc
lxc.cgroup.devices.allow = a
lxc.cap.drop =

Now restart the container:

sudo lxc restart lxd-homeassistant


Step 3 – Install required packages for Home Assistant

Within your container, run these commands:

Update your packages:

sudo apt-get update

Install required packages:

sudo apt-get install bash jq curl avahi-daemon dbus software-properties-common apparmor-utils libnss-mdns mdns-scan


Step 4 – Update and reboot the LXC container

Still within the container, follow the step below:

There is a known issue which can affect install Home Assistant. An upgrade and reboot should fix the issue:

sudo apt update && sudo apt dist-upgrade


Step 5 – Run the Home Assistant script

Still within the container:

Run the install script: (This is the updated method using a ‘Supervised’ install as of 18/06/2020)

curl -sL | bash -s -- -m qemux86-64

The installation will take up to 20 minutes depending on how fast your Internet connection is.

Alternatively, the old method may still work, or may not:

curl -sL "" | sudo bash -s -- -m qemux86-64

Once Home Assistant is installed, you can access the setup via: http://YOUR-LXC-CONTAINER-IP:8123/ – Replace YOUR-LXC-CONTAINER-IP with your own LXC container’s IP Address.


  • June 7th, 2020

Hi Ryan,
thank your for putting these steps together!

Steps 3-5 need to be executed in the container itself, right?


  • June 7th, 2020

Hi Andreas, Yes that’s correct. Steps 3-5 are to be run in the container.


  • June 18th, 2020

I am getting a 404 error when trying to run the curl command to install the script. Did they remove the script from Github?

  • June 18th, 2020

Hi David, yes they have moved this method to a new repo, known as the supervised install:

FYI Discussion regarding deprecation on this method is continuing on GitHub and Home Assistant’s website.

For now, I am still using this method, everything seems to be working. There was a lot of backlash regarding their deprecation announcement which they announced on 10th May 2020, this forced them to put the deprecation on hold as of 24th May 2020.

Post a Comment