Save Realms persistent on Keycloak

Hi everyone,
I have searched all possible stackoverflow pages today but unfortunately none of the solutions work. Namely, my keycloak server does not save any realms after shutting down and starting the Docker container. I have specified volumes in the database, but unfortunately everything is deleted again after a restart.
I did not find anything in the keycloak documentation. Maybe someone can help me

version: '3'

volumes:
  postgres_data:
      driver: local

services:
  postgres:
      image: postgres
      environment:
        POSTGRES_DB: keycloak
        POSTGRES_USER: keyuser
        POSTGRES_PASSWORD: pw
      volumes:
        - postgres_data:/var/lib/postgresql/data
        - ./data:/docker-entrypoint-initdb.d
      ports:
      - "5432:5432"
  keycloak:
    image: quay.io/keycloak/keycloak:21.1.1
    container_name: keycloak
    #restart: always
    command: start --optimized --hostname=*not imprtant* --proxy=edge --hostname-strict=false
    environment:
      - DB_ADDR=postgres
      - DB_DATABASE=keycloak
      - DB_USER=keyuser
      - DB_SCHEMA=public
      - DB_PASSWORD=pw
      - PROXY_ADDRESS_FORWARDING=true
      - KEYCLOAK_HTTP_ENABLED=true
      - KEYCLOAK_ADMIN=admin
      - KEYCLOAK_ADMIN_PASSWORD=pwAdmin
    depends_on:
      - postgres

Hello all,
I have fixed my problem.
The env variables were wrong and keycloak used the default h2 database which was not mounted as volume in docker. Additionally I set the env variable QUARKUS_TRANSACTION_MANAGER_ENABLE_RECOVERY to true. Since I am working with traefik, here is the whole docker compose file. Now everything works.

version: '3'

volumes:
  postgres_data:
      driver: local

services:
  postgres:
      image: postgres:15
      environment:
        POSTGRES_USER: keyuser
        POSTGRES_PASSWORD: pw
      networks:   
        - web
      volumes:
        - postgres_data:/var/lib/postgresql/data
        - ./data:/docker-entrypoint-initdb.d
  keycloak:
    image: quay.io/keycloak/keycloak:21.1
    container_name: keycloak
    #restart: always
    command: start --hostname=*notImportant* --proxy=edge --hostname-strict=false
    networks:   
      - web
    environment:
      KC_DB_URL_HOST: postgres
      KC_DB_SCHEMA: public
      KC_DB_USERNAME: keyuser
      KC_DB_PASSWORD: pw
      KC_DB: postgres
      KEYCLOAK_LOGLEVEL: ALL
      QUARKUS_TRANSACTION_MANAGER_ENABLE_RECOVERY: true
      PROXY_ADDRESS_FORWARDING: true
      KEYCLOAK_HTTP_ENABLED: true
      KEYCLOAK_ADMIN: user
      KEYCLOAK_ADMIN_PASSWORD: pw
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.keycloak.rule=Host(`*notImportant*`)"
      - "traefik.http.routers.keycloak.entrypoints=websecure"
      - "traefik.http.routers.keycloak.tls.certresolver=myresolver"
    depends_on:
      - postgres

networks:
  web:
    external: true

Whats in your ./data ? or why do you copy it?