Thursday, November 14, 2024

Update Home Assistant docker installation

In order to safely update your docker container in a Synology NAS. I assume you manage your docker containers via docker-compose

  1. List the running containers
    docker ps
  2. Go to the docker folder
    cd /volume1/docker
  3. Copy the configuration (if needed)
    cp -rp ha /volume2/backups/ha-bak.24.11
  4. Stop the container
    docker stop homeassistant
  5. Make a backup
    docker commit homeassistant homeassistant-backup:version-24.11
  6. Pull the latest image
    docker pull ghcr.io/home-assistant/home-assistant:stable

    or if you want a specific version
    docker pull ghcr.io/home-assistant/home-assistant:2024.11.3
  7. Remove the container
    docker rm homeassistant
  8. If you have a specific version to use, edit the version of the image in the docker-compose file to the downloaded one (2024.11.3, default is stable)
    vi docker-compose.yaml
  9. Start up the new container
    docker-compose --verbose up -d homeassistant

Checklist afterwards:

  • Check if configuration is loaded correctly:
    docker exec homeassistant python -m homeassistant --script check_config --config /config
  • Check for version: Settings > About
  • Check for logs: Settings > System > Logs
  • Update HACS plugins if needed
For a full recovery of a container:
  1. Stop and Remove the Current Container:
    docker stop homeassistant

    docker rm homeassistant
  2. Run a New Container from the Backup Image (or edit your docker-compose.yaml and start with docker-compose):
    docker run -d --name homeassistant \ --restart=unless-stopped \ -v /volume1/docker/ha:/config \ -e TZ=Europe/Paris \ --net=host \ homeassistant-backup:version-24.11


No comments:

Post a Comment