Configuration gone after container recreation with portainer

After recreation the HA container with portainer the configuration seems to be gone. When I open the HA page I can only create a new Smart Home.

Where can I find my old configuration and how can I start it with the new container?

Hello,

is the path the same for the config folder in old as in new container?
How many HA container you see in portainer?
Many times when you recreate docker gives an fantasy name.
Normally you have your path and as long as you did not deleted the folder or files using the same path the container should pickup the old config.

I’m a noob.
I don’t know where the config folder is. Can you tell me where is your config folder?
I have altogether 3 containers like before: Portainer, HA and a clould-server

You should go look at whatever thing you used to create the other HA container (Docker Compose or a Docker run command) and see where you mapped config to. That mapping is where your config folder is. You should, in theory, be able to add that same mapping to the Portainer setup and then HA will just start with your old config.

The old and the new containers were created with Portainer. The old one is no longer visible. Only the new one is visible.
When opening the container console I can see the config folder:

raspberrypi:/config# ls -l
total 552
-rw-r--r--    1 root     root             2 Dec 20 15:31 automations.yaml
drwxr-xr-x    4 root     root          4096 Dec 20 15:31 blueprints
-rw-r--r--    1 root     root           265 Dec 20 15:31 configuration.yaml
drwxr-xr-x    2 root     root          4096 Dec 20 15:30 deps
-rw-r--r--    1 root     root             0 Dec 20 20:51 home-assistant.log
-rw-r--r--    1 root     root           698 Dec 20 15:33 home-assistant.log.1
-rw-r--r--    1 root     root             0 Dec 20 20:51 home-assistant.log.fault
-rw-r--r--    1 root     root        188416 Dec 20 20:51 home-assistant_v2.db
-rw-r--r--    1 root     root         32768 Dec 20 21:12 home-assistant_v2.db-shm
-rw-r--r--    1 root     root        309032 Dec 20 21:12 home-assistant_v2.db-wal
-rw-r--r--    1 root     root             0 Dec 20 15:31 scenes.yaml
-rw-r--r--    1 root     root             0 Dec 20 15:31 scripts.yaml
-rw-r--r--    1 root     root           161 Dec 20 15:31 secrets.yaml
drwxr-xr-x    2 root     root          4096 Dec 20 15:31 tts

The configuration files were created today. I wonder where the old ones are?

Hey,

maybe you have removed it by mistake?
Go in portainer, click on Containers
Click on the name of HA container
Scroll the page down to Volumes section
Left column is the path in the OS of the computer
Right is the path in container

After that you noted it down, you can navigate to path and see if there are any folder or files that are from the old one.

Just guessing, if you did not changed anything in setup, you probably installed it in your user home folder, so it might be there somewhere.

It looks a little bit different here. The structure of the HA container details looks as follows:

  • Actions
  • Container status
  • Access control
  • Create image
  • Container details
  • Connected networks

When I look at the Container details, it looks like I’ve recreated the old version instead a new one:

Created 	2024-12-20 16:30:47
...
org.opencontainers.image.created 	2024-01-20 19:03:46+00:00

In the navigation tree on the left side I can open the Volume list. It contains 3 entries.

# ls -l /var/lib/docker/volumes/0493c4e2a767a1482d9307197fe175e3bd05fa56967e09d080527dadb29b36ff/_data/
total 139432
-rw-rw---- 1 999 spi  16908288 Jan 31  2024 aria_log.00000001
-rw-rw---- 1 999 spi        52 Jan 31  2024 aria_log_control
-rw-rw---- 1 999 spi         9 Jan 31  2024 ddl_recovery.log
-rw-rw---- 1 999 spi       828 Jan 31  2024 ib_buffer_pool
-rw-rw---- 1 999 spi  12582912 Jan 31  2024 ibdata1
-rw-rw---- 1 999 spi 100663296 Jan 31  2024 ib_logfile0
-rw-rw---- 1 999 spi  12582912 Jan 31  2024 ibtmp1
-rw-rw---- 1 999 spi         0 Jan 31  2024 multi-master.info
drwx------ 2 999 spi      4096 Jan 31  2024 mysql
-rw-r--r-- 1 999 spi        15 Jan 31  2024 mysql_upgrade_info
drwx------ 2 999 spi      4096 Jan 31  2024 performance_schema
drwx------ 2 999 spi     12288 Jan 31  2024 sys
# ls -l /var/lib/docker/volumes/32463b122ef97dcec75eeb50394fc0e2ce0093cad35c7048cda47aa79c020711/_data/
total 139432
-rw-rw---- 1 999 spi  16908288 Jan 31  2024 aria_log.00000001
-rw-rw---- 1 999 spi        52 Jan 31  2024 aria_log_control
-rw-rw---- 1 999 spi         9 Jan 31  2024 ddl_recovery.log
-rw-rw---- 1 999 spi       828 Jan 31  2024 ib_buffer_pool
-rw-rw---- 1 999 spi  12582912 Jan 31  2024 ibdata1
-rw-rw---- 1 999 spi 100663296 Jan 31  2024 ib_logfile0
-rw-rw---- 1 999 spi  12582912 Jan 31  2024 ibtmp1
-rw-rw---- 1 999 spi         0 Jan 31  2024 multi-master.info
drwx------ 2 999 spi      4096 Jan 31  2024 mysql
-rw-r--r-- 1 999 spi        15 Jan 31  2024 mysql_upgrade_info
drwx------ 2 999 spi      4096 Jan 31  2024 performance_schema
drwx------ 2 999 spi     12288 Jan 31  2024 sys
# ls -l /var/lib/docker/volumes/portainer_data/_data
total 156
drwx------ 2 root root   4096 Jan 28  2024 bin
drwx------ 2 root root   4096 Jan 28  2024 certs
drwx------ 2 root root   4096 Jan 28  2024 chisel
drwx------ 2 root root   4096 Jan 28  2024 compose
drwx------ 2 root root   4096 Jan 28  2024 docker_config
-rw------- 1 root root 131072 Dec 20 23:42 portainer.db
-rw------- 1 root root    227 Jan 28  2024 portainer.key
-rw------- 1 root root    190 Jan 28  2024 portainer.pub
drwx------ 2 root root   4096 Jan 28  2024 tls

Sorry,
I can’t follow what is the point?

Suggestion use just ls, no need for all that information.
The container has a path on your computer and then this is related to the container.

It is something like:

Host. Container
/home/user/config. /config

Depending how you performed the install, it is you choosing path, so you should retrieve the path and find where you put the config.
Here a way that normally should work to understand volumes in portainer.

My fear here is that you really don’t understand how containers work. It sounds like you had a container for HA, but if you didn’t map /config to a location on your hard drive, then HA started up and used the config folder INSIDE the container. If you created a new container and deleted the old one, then your old config is gone. If you didn’t delete the old container, then there are some ways with Docker to get files out of a container. It’s not straightforward though. This is why when you use a container you should map things that the program writes to disk to a place on your local hard drive. If you do that you can delete a container and recreate it without affecting all your data.

@samo9999 in support of both people responding, maybe can you explain how (!) you built the container before (not this last time, if different)?

Trying to find out if your did you specify a separate volume for the config? If you did not, then all is likely gone. The installation instructions of HA clearly specify the use of a volume