Entities unavailable after Matter - Python container update + restart

I have a matter-Python container with docker. Everytime I update and rebuild the container. All Entities are unavailable. I have to manually re-add them.

Does anyone have an idea on how to prevent this from happening?
Or bulk add / recconect them?

Docker compose:

  matter-server:
    image: ghcr.io/home-assistant-libs/python-matter-server:stable
    container_name: matter-server
    # Required for mDNS to work correctly
    network_mode: host
    security_opt:
      # needed for bluetooth via dbus
      - apparmor=unconfined
    command: "--log-level debug"
    # ports:
    #   - "5580:5580/tcp"
    volumes:
      - /opt/matter/data:/data/
      - /opt/matter/run/dbus:/run/dbus:ro
      # If you adjust command line, make sure to pass the default CMD arguments too:
      #command: --storage-path /data --paa-root-cert-dir /data/credentials --bluetooth-adapter 0
      - /etc/timezone:/etc/timezone:ro

My guess is that the rebuilding is re-seeding the encryption keys, so you lose your old network.
A work around could be to add another bridge ne then just rejoin the network on that bridge when rebuilding.

Can you point me in the right direction on how to do that?

Do you mean changing the network:host to network:bridge in the docker compose file?

I saw some other post about the Matter server and it mentioned that the config library was local and therefore destroyed during the rebuild.
You need to back that up and restore it after the rebuild.
I am sadly not able to do the search for that post where I am, so you will have to do it yourself.
I thi knit was Agnes that made the reply.