Restore home assistant running in docker container

Docker does Not have backup/restore

If you copy/move config and start docker container it will run and be “restored”. To backup docker you can copy/zip contents of /config and verify you got all contents of hidden folder
…. This is docker method basically

Hi…backup has been introduced for docker/containers since 2022.4… is clearly available, works but should also (!) be usable for restore

2022.4: Groups! Groups! Groups! - Home Assistant (home-assistant.io)

Completely forgot

Interestingly, backup is missing from my configuration page. I swear it was there when I first went to 2202.4 :thinking:

EDIT

Had to add “backup” to my config

I got three dots on mobile IOS app. it only allows Download backup and Delete backup. It completely unusable in app since there is some weird aspect thing going on that prevents it from displaying properly. Download option disappears in landscape and only delete remains

In web the three dots only allow delete and backup

Back to the future :slight_smile:
But all jokes aside, the backup works but has to be scheduled separately/manually and the content of the file can be used manually. For me this is not usable unless I have the means to properly restore it or parts of it. I wanted to test this out to see if this is of any use as the text/the documentation sounds promising …but I just donot have the time to go in mode trial/error. I will raise a ticket for now

EDIT: ticket raised: New 2022.4 new feature for backup of a.o. container: no restore seems available · Issue #70840 · home-assistant/core · GitHub

btw, i just browsed through one of the backups and in fact it is indeed nothing more than the /config…I should have analysed this earlier.
In that case I will probably stick with duplicati allowing to include/exclude folders and do partial restore gui-wise. I was hoping on a bit more but…well

Issue was kicked back so I added a feature request now, please vote if you are OK
2022.4 Backup for a.o. container: allow restore as per documentation - Feature Requests - Home Assistant Community (home-assistant.io)

3 Likes

Same here. Updating docker from 2022.7.5 to 2022.7.6 didnt work so i did a backup, downloaded it and created a new docker container from scratch. Now theres no way to restore the backup. No restore-button at first welcome, nore in the whole process or later in gui or backup-section. Seems as i have to reconfigure all.

damn…

No you don’t have to reconf… the tar-backup you have contains all /config elements so you can unpack them and copy it there

i tried it today with copy all the file from the /config directory (in my case a volume mount with docker).
But in the end i have to say that homeassistant didn’t accept the files and i have to setup everything on my own. Integrations aren’t setup anymore, user login as well…

Do you have a clue what’s the problem?

File permission issue

Copied files not accessible by new HA.

I have no clue what system you are running on but can’t you just check file permissions and amend? If you can copy/write then I assume you can also tailor these to what HA expects, e.g. check what file permissions are set on the config folder/dir and align them

If you are running a docker container, it will all be owned by root:root.

Maybe, but there are plenty of files and a gui-guided selection would be much better, than copy-paste-all. Especially, if someone (like me) would like to find out, which files create a special behaviour or bug. That’s what i can not find out by copy-paste-all, as i dont know, what each file is used for.

Additionally i am not very used to cli but more a “normal” user with a very little bit of experience in linux / terminal.

as for now i backup everything, in the hope for future ability to use one of them: the TARs created by HA-backup and the full images created by portainer/docker.
:pensive:

I would not see why HA would step into this when many alternatives are available.
Use another backup tool that allows file/directory based backup/restore, e.g. duplicati is great (my view)

Thanks, but how do we restore the files? The content of the full backup I have has several .gz, do I need to manually extract all those?

I followed the link you posed and I see the mention of backup/restore for container installation but there are no instructions on how to restore

you can restore the backup using homeassistant UI

IF you cannot do that, inside the backup there is a homeassistant.tar.gz.
Inside homeassistant.tar.gz there is “/data” folder that appears to be backup of the full HA config folder
Create homeassitant container
Run homeassistant container and verify you get setup or login screen
Stop homeassistant container.
Replace current homeassistant /config folder with full contents (including hidden folders) of /data from backup
Restart homeassistant container. All should work

NOTE
Version of backup should match version of container. Do not restore config from 2022.3.1 to 2022.9.1 or even 2022.9.1 to 2022.9.3. If you want to update do that after restore. The backup is named after the version and docker tags allow you to restore specific version so it should be easy to manage.

1 Like

The container itself does not need a backup, you can pull this ‘anytime’ from docker
The duplicati setup I have does only do backs-up for the persistent part of my containers and duplicati allows to restore single files

Hi,

I’m having the same problem.
I’m stuck at this part :
Replace current homeassistant /config folder with full contents (including hidden folders) of /data from backup

How you manage to do that ? I’m not an expert with Docker and containers.

Nevermind, I managed to do it.
But when I log in to the interface of Home Assistant, i’m still welcomed by the onboarding screen, and cannot access to whatever I had configured before.
When I access the container via portainer I can see it’s got all my files and configurations under it’s config folder …

Is there something to do ?

Thank’s

It has config but did you open file and check the contents?

Is “.secrets” folder in config folder?

I think it just doesn’t start if file permissions are incorrect but check that.

Look at logs during start in portainer. Make sure it loads config and givs no error

EDIT

Onboarding message may be caused by missing .secrets or inability to access it

I did check what’s inside the config folder and there is my custom_components, my config file refers to devices etc
I also reconfigured mqtt broker in the devices page and all my zigbees devices were automaticly configured. So I assume it has loaded my configuration but not totally.

But, I need to reconfigure lots of things that I should not have to : dashboards, persons, devices etc

I don’t have a .secrets folder neither in my backup folder or in my config folder.

No relevant information in portainer logs during startup

EDIT :

Ok, I managed to get it working.
In fact, I used cp command to copy my files BUT without the -R it doesn’t copy the hidden folders.
When I started Home Assistant container, it created the missing folders so when I checked if everything was ok, it seemed, indeed.
But, then I checked their content and compared to my backup and there were some files missing, a lot in fact.

Thank’s for your help and I hope it will contribute to helping others.

1 Like