Hassio Docker Raspberry Pi 4


Originally posted 2018-08-27 16:37:41.

Using a Raspberry Pi for more than Hass.io EDIT: TIL that Hass.io is the docker distribution of Home Assistant. I initially thought that it was the Home Assistant software itself and you had to manually install it in a clean Raspbian image OR use the prebuilt Haspbian, and was wondering which of these two (manual install or prebuilt) was the best. How to Install Docker on Raspberry Pi. Step 1: Update and Upgrade. Step 2: Download the Convenience Script and Install Docker on Raspberry Pi. Step 3: Add a Non-Root User to the Docker Group. Step 4: Check Docker Version and Info. Step 5: Run Hello World Container. Raspberry Pi Docker Images.

How to use Hass.io and boot off a USB stick.

In order to not create more confusion I decided to do a new blog post about this here. The whole installation of home assistant can be somewhat confusing for someone who is new and sometimes the documents on the Home Assistant site are confusing or as often happens, 100% clear when you have already worked out what you want to know.

The ‘preferred’ installation method for home assistant promoted on https://www.home-assistant.io/ is to install Hass.io This installation method effectively turns home assistant into an appliance that pretty much looks after itself and is easily updated by the click of a button. There are other installation methods like installing Home Assistant in a virtual environment etc… I can already feel your eyes glazing over!

At the simplest level, and only considering a Raspberry Pi for now, the installation options are like this:

  1. Install Hass.io using the Hass.io image on the Home Assistant Site
  2. Install Hassbian using the Hassbian image on the Home Assistant Site
  3. Installing Raspbian yourself and then installing Home Assistant in a virtual environment. Installing Hassbian is the same for all practical purposes except it does all the heavy lifting for you.

There’s a number of reasons why these options might not suit you. Using Hass.io pretty much locks down your system so nothing else can be run on it except Hass.io. Some people seem to really want to run a whole bunch of other things on their Pi as well as Home Assistant so they might choose option 2 or 3. Usually, fairly quickly, these people will come to the Home Assistant forum and complain about problems they are having that they wouldn’t have had at all if they lashed out another $35 and got a separate Pi to play with and just used their first Pi to only run Hass.io. People will also work out pretty fast that they really do want to run hass.io as it has all these other cool add-ons that are not available with option 2 or 3. (and people choosing option 2 or 3 also come to the forum and complain about not having the hass.io tab in the side panel)

A lot of people for whatever reason also seem to have a lot of problems with SD-Cards failing. This may or may not be due to poor quality cards and rightly or wrongly, some people seem to prefer to use a USB stick or even an SSD instead. Home Assistant is quite heavy on writing to the database which could contribute to failure with cards that don’t have wear leveling for writes on the card. Flash memory eventually fails. Writing data to a SD card physically and permanently damages the chip. Overtime this causes the SD card to fail. There are 2 different kinds of chip used – TLC cards (which are cheapest) can overwrite itself 500 times before experiencing failures, an MLC card (more expensive) can overwrite itself between 1500 to 3000 times before failing.

When I wrote my original article, I showed how to install Hass.io and run it with the RPi booting from USB instead of an SD-Card. This required the OTP (one-time-programmable) bit to be set on a RPi3B. The newer RPi3B+ has this set out-of-the-box. The Home Assistant developers at that time were using a bas operating system for Hass.io on a RPi called ResinOS. For technical reasons they decided to move away from ResinOS and wrote their own new base operating system her Hass.io called HassOS. This was released as stable in July 2018. Unfortunately, the developers also decided that they would not support USB boot for HassOS although my understanding is that they are going to support it in the next release which is great news!

The other issue has been that for some months, the new RPi3B+ was not supported and would not run ResinOS. This meant that new users had to use either option 2 or 3 above and miss out on the nice features of Hass.io. There is also the consideration that security wise, people on ResinOS needed to consider upgrading to a supported environment and thus HassOS.

As HassOS was not available for quite a while, one of the developers Dale3h wrote a script for a RPi3B+ that you could install and run over the top of Raspbian. The script was promoted for the RPi3B+ only however I found it installed and ran perfectly on a RPi3B. It may also run on a lower Pi as well but I would not recommend trying it on anything less than a Pi3B. What the script does is install Docker with all dependencies and then installs Hass.io and any add-ons in it’s own containers.

The script written by Dale3h can be found here. Follow the installation instructions and you will end up with a Raspberry Pi 3B or 3B+ running hass.io in docker but instead of being based on HassOS or ResinOS, based on Raspbian! There are a couple of limitations such as the hass.io ssh addon does not work but there is a community addon as an alternative. It was simple to restore a snapshot and I was up and going again immediately. I did find that the configurator addon and the dropbox addon was not working and I had to install and configure them again. One other thing is that I was getting a lot of database errors so I deleted the database and restarted hass.io server. That’s it!

I made the decision a few weeks ago that I was going to upgrade from a Raspberry Pi to an Intel NUC so before I did that I decided to try Dale’s script on a Pi. I found that Hass.io running on Raspbian was much faster than HassOS and on par with ResinOS.

Latest I heard, the developers of Home Assistant are planning to make a USB installation for Hass.io in the near future. In any case, it was a great learning experience doing this and really helped me to understand Docker that I had never used before. It was a great entree to moving to using a NUC which is the subject of my next article here.

Related Posts

Please remember to ensure you’re using an appropriate power supply with your Raspberry Pi. Mobile chargers may not be suitable, since some are designed to only provide the full power with that manufacturer’s handsets. USB ports on your computer also will not supply enough power and must not be used.

Install Home Assistant Operating System

Follow this guide if you want to get started with Home Assistant easily or if you have little to no Linux experience

Suggested Hardware

We will need a few things to get started with installing Home Assistant. Links below lead to Amazon US. If you’re not in the US, you should be able to find these items in web stores in your country.

  • Raspberry Pi 4 (Raspberry Pi 3 is ok too, if you have one laying around)
  • Power Supply for Raspberry Pi 4 or Power Supply for Raspberry Pi 3
  • Micro SD Card. Ideally get one that is Application Class 2 as they handle small I/O much more consistently than cards not optimized to host applications. A 32 GB or bigger card is recommended.
  • SD Card reader. This is already part of most laptops, but you can purchase a standalone USB adapter if you don’t have one. The brand doesn’t matter, just pick the cheapest.
  • Ethernet cable. Home Assistant can work with Wi-Fi, but an Ethernet connection is more reliable and highly recommended.

Write the image to your boot media

  1. Attach the Home Assistant boot media (SD card) to your computer

  2. Download and start Balena Etcher

  3. Select “Flash from URL”

  4. Get the URL for your Raspberry Pi:

Raspberry Pi 4 32-bit
Raspberry Pi 3 32-bit

(64-bit is recommended)

(64-bit is recommended)

Select and copy the URL or use the “copy” button that appear when you hover it.

  1. Paste the URL for your Raspberry Pi into Balena Etcher and click “OK”
  2. Balena Etcher will now download the image, when that is done click “Select target”
  3. Select the SD card you want to use for your Raspberry Pi
  4. Click on “Flash!” to start writing the image
  5. When Balena Etcher is finished writing the image you will get this confirmation

Start up your Raspberry Pi

  1. Insert the boot media (SD card) you just created

  2. Attach a ethernet cable for network.

  3. Attach a cable for power

  4. Within a few minutes you will be able to reach Home Assistant on homeassistant.local:8123. If you are running an older Windows version or have a stricter network configuration, you might need to access Home Assistant at homeassistant:8123 or http://X.X.X.X:8123 (replace X.X.X.X with your Raspberry Pi’s IP address).

With the Home Assistant Operating System installed and accessible you can continue with onboarding.

Install Home Assistant Container

These below instructions are for an installation of Home Assistant Container running in your own container environment, which you manage yourself. Any OCI compatible runtime can be used, however this guide will focus on installing it with Docker.


This guide assumes that you already have an operating system setup and a container runtime installed (like Docker).


If you are using Docker then you need to be on at least version 19.03.9, ideally an even higher version, and libseccomp 2.42 or newer.

Platform Installation

Installation with Docker is straightforward. Adjust the following command so that /PATH_TO_YOUR_CONFIG points at the folder where you want to store your configuration and run it.

Raspberry pi 3

Raspberry pi 4

Once the Home Assistant Container is running Home Assistant should be accessible using http://<host>:8123 (replace with the hostname or IP of the system). You can continue with onboarding.


Restart Home Assistant

If you change the configuration you have to restart the server. To do that you have 3 options.

  1. In your Home Assistant UI go to the Configuration panel -> Server management and click the “Restart” button.
  2. You can go to the Developer Tools -> Services, select the service homeassistant.restart and click “Call Service”.
  3. Restart it from a terminal.

Hassio Docker Raspberry Pi 4 Software

Docker Compose

In order to use docker-compose you first need to install docker-compose on your system.

As the Docker command becomes more complex, switching to docker-compose can be preferable and support automatically restarting on failure or system restart. Create a docker-compose.yml file:

Raspberry pi 3

Raspberry pi 4

Start it by running:

Exposing Devices

In order to use Z-Wave, Zigbee or other integrations that require access to devices, you need to map the appropriate device into the container. Ensure the user that is running the container has the correct privileges to access the /dev/tty* file, then add the device mapping to your container instructions:


The Home Assistant Container is using an alternative memory allocation library jemalloc for better memory management and Python runtime speedup.

As jemalloc can cause issues on certain hardware, it can be disabled by passing the environment variable DISABLE_JEMALLOC with any value, for example:

The error message <jemalloc>: Unsupported system page size is one known indicator.

Install Home Assistant Core


This guide assumes that you already have an operating system setup and have installed Python 3.8 (including the package python3-dev) or newer.

Install dependencies

Before you start make sure your system is fully updated, all packages in this guide are installed with apt, if your OS does not have that, look for alternatives.

Install the dependencies:

Create an account

Add an account for Home Assistant Core called homeassistant.Since this account is only for running Home Assistant Core the extra arguments of -rm is added to create a system account and create a home directory.The arguments -G dialout,gpio,i2c adds the user to the dialout, gpio and the i2c group. The first is required for using Z-Wave and Zigbee controllers, while the second is required to communicate with GPIO.

Create the virtual environment

First we will create a directory for the installation of Home Assistant Core and change the owner to the homeassistant account.

Hassio Docker Raspberry Pi 4 Manual

Next up is to create and change to a virtual environment for Home Assistant Core. This will be done as the homeassistant account.

Once you have activated the virtual environment (notice the prompt change to (homeassistant) [email protected]:/srv/homeassistant $) you will need to run the following command to install a required Python package.

Once you have installed the required Python package it is now time to install Home Assistant Core!

Start Home Assistant Core for the first time. This will complete the installation for you, automatically creating the .homeassistant configuration directory in the /home/homeassistant directory, and installing any basic dependencies.

Install Hassio Docker Raspberry Pi 4

You can now reach your installation via the web interface on http://homeassistant.local:8123.

If this address doesn’t work you may also try http://localhost:8123 or http://X.X.X.X:8123 (replace X.X.X.X with your machines’ IP address).

When you run the hass command for the first time, it will download, install and cache the necessary libraries/dependencies. This procedure may take anywhere between 5 to 10 minutes. During that time, you may get “site cannot be reached” error when accessing the web interface. This will only happen for the first time, and subsequent restarts will be much faster.

Hassio Docker Raspberry Pi 4 Download

We get commissions for purchases made through links in this post.

Hassio Docker Raspberry Pi 4 Specs

Help us to improve our documentation

Suggest an edit to this page, or provide/view feedback for this page.
  • Most Viewed News

    • High Sierra Usb Boot Disk
    • Folx Go Free Mac
    • Windows Server On Docker