How to update Home Assistant Docker Container

Continuing from my previous guide on how to setup Home Assistant + Docker + Z-Wave + Raspberry Pi, this tutorial will show you how to update Home Assistant to the latest version. Updating Home Assistant to the latest version is critical to ensure you have the latest bug fixes, integrations, and security patches.

Note: during the update your devices will continue to work fine, but please note any automations or access to the application will not be available, so it’s recommended to do this during a time that you know no automations will be running.

Validate your current version

Navigate to the Developer Tools section of Home Assistant. Here you can validate the latest version you currently have deployed.

Get the current name of your container and version

sudo docker ps

In running this command, note the NAME of your container as well as the IMAGE.

Stop and delete the container

Replace the name of the container in the command below with the value you had.

sudo docker stop home-assistant
sudo docker rm home-assistant

Update packages

Some versions of HA require newer versions of Python, Docker, etc. I may consider updating to latest package versions first.

sudo apt-get update
sudo apt-get upgrade

Pull the latest container from Docker Hub

Replace the value below with your IMAGE value you documented in the previous steps.

sudo docker pull homeassistant/raspberrypi4-homeassistant:stable

Deploy the container

Make sure your replace the name and value of the image with the values in the previous step. In addition, ensure you specify the correct path to where you existing configuration files exist to have the container load your existing configurations.

sudo docker run --init -d --restart=always --name="home-assistant" -e "TZ=America/Chicago" --device=/dev/ttyACM0 -v /home/docker/home-assistant:/config --net=host homeassistant/raspberrypi4-homeassistant:stable

Note: If you are now using the Z-Wave JS docker container, you will not want to attach the Z-Wave stick to the Home-Assistant container. In this case, run the following command:

sudo docker run --init -d --restart=always --name="home-assistant" -e "TZ=America/Chicago" -v /home/docker/home-assistant:/config --net=host homeassistant/raspberrypi4-homeassistant:stable

Validate your version number

After a few minutes, navigate back to the Developers Tools page. Upon load, you should now be on the latest version of Home Assistant.

Notes:

You can find the latest, stable, and development builds out on docker hub here: https://hub.docker.com/u/homeassistant

For example, for raspberrypi4 builds, here you can validate the versions of all the different containers offered: https://hub.docker.com/r/homeassistant/raspberrypi4-homeassistant/tags

6 thoughts on “How to update Home Assistant Docker Container

  1. Some Annoyed Guy

    While this successfully updated my Home Assistant, it COMPLETELY REMOVED ALL OF MY CONFIGURATION and I had to re-add all of my devices, integrations, automations…. everything…

    Perhaps the author should have mentioned something about this

    Reply
    1. Jack Post author

      If the update wiped your devices/configuration, it sounds like the path of where your configuration is stored is different from what is listed in the article. On the Deploy the container step, this is called out.

      Reply
      1. Luis

        Hey,

        this is not right 😅
        This method also removed all of my config even though I changed the path to the correct one..
        I don’t know why this differs to your installation but the only thing I noticed was different was that your version-numbers are in a 0.xxx.xx format, while mine are in a 2021.x.x (basically a date) format.

        For me it’s not too bad since I was just starting to set it up but I can see why someone following this guide might be very upset.

        Greetings
        Luis

        Reply
        1. Jack Post author

          The guide was written prior to the 20XX.X.X version nomenclature, but still holds true to the latest versions using the 20XX.X.X versions. I still use this guide for updating my version of Home Assistant and the settings do persist. Make sure you are pointing to the proper directory you used to store your configuration; the commands themselves assumes the configuration for your HA deployment is in /home/docker/home-assistant; yours may be different.

          I’ve gone ahead and updated the images to show this is possible as well.

          Hope this helps!
          Jack

          Reply
  2. Pingback: How to upgrade Home Assistant Z-Wave integration to Z-Wave JS for Docker | Jack Stromberg

  3. Pingback: How to update Z-Wave JS Docker Container | Jack Stromberg

Leave a Reply to Some Annoyed Guy Cancel reply

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