Docker container forklift move HA - don't stress, it's really easy

I followed a howto on Seeed’s website which got me an install of HA that was 2023.something. It also points at a repository that isn’t updated. I needed to get on the correct official stable version and be running 2025.1.

Then I noticed that the native backup and restore was… lacking.
image

I thought surely the first one I did was labeled “full,” but no.

Here’s how to fix it (not the partial backups) and get on the main official release. Package home-assistant · GitHub

This is the equivalent of moving an mssql DB by moving the mdb/ldb of a SQL database. If you’ve done that before you can do this. Don’t even worry about those partial backups, you won’t use them.

Download that image to your docker server but don’t make a container with it yet.

Stop your soon-to-be-former HA server container.
Search for the home-assistant_v2.db file that’s the sqlite database. If you see other files with that name and other extensions your HA docker image is still running. You’ll see overlay in the path name and there’s a really long hexadecimal in the path too. Copy the path, you’ll need it. You must have your container stopped so that sqlite isn’t running. You will not get a good copy of it if it’s running.

Chances are good the /root partition is not very big. Don’t back up anything in there. You can make a copy of your database at this point, but you’re not going to do anything with the copy.

Go ahead and stop the original container. If you’re setup in host mode it’s fine to set the other container up in host mode, you’re not going to run them both simultaneously anyway. Note that docker containers aren’t virtual machines and their filesystems are just subsets of the host filesystem. So when it’s stopped the files are still accessible.

All you need to do is download the latest 2025.1 image from the Package home-assistant · GitHub.

Start your new container that’s pulling from the correct repository. Let it start until you get to the login window. There’s no need to create a user. The database doesn’t exist in the downloaded container, but if you let it run until it’s asking you to setup a user, the database exists. Stop your new container.

You should search the host filesystem in the docker overlay directory for home-assistant_v2.db again. You’ll now see there are two such entries. It’ll look identical to the first one you found but with a different hexadecimal in the path.

Recursively remove the entire config directory from the new container path.

Then recursively copy the whole config directory (which includes the sqlite db) from the former container into the new one.

Start the new container. It’s got your same data and config as the old one now. If you really feel you need a do-over, you can still fall back to the old one.

1 Like