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 ghcr.io/home-assistant/raspberrypi4-homeassi stant: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 -d --restart=always --name="home-assistant" -e "TZ=America/Chicago" --device=/dev/ttyACM0 -v /home/docker/home-assistant:/config --net=host ghcr.io/home-assistant/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 -d --restart=always --name="home-assistant" -e "TZ=America/Chicago" -v /home/docker/home-assistant:/config --net=host ghcr.io/home-assistant/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
In newer versions of the docker container --init should not be specified in the docker run command. Specifying --init will result with the following error: "s6-overlay-suexec: fatal: can only run as pid 1". This was mentioned as a breaking change in: 2022-06-01 update: 2022.6: Gaining new insights! - Home Assistant (home-assistant.io)