Keycloak Quarkus distributions not retaining data after docker compose down

Hi All,

I have this docker compose file that starts Keycloak version 22 in development mode.
The idea is to have a postgresql db retaining the user data after “docker compose down”

the code below works with keycloak wildfly distributions, but in quarkus ones it doesn’t seem to retain data.

version: '3.4'

services:
  postgres:
      image: postgres
      container_name: postgres-kc
      volumes:
        - ./postgres_data:/var/lib/postgresql/data 777
      environment:
        POSTGRES_DB: keycloak
        POSTGRES_USER: keycloak
        POSTGRES_PASSWORD: keycloak
      networks:
      - kc-lite
  keycloak:
      image: quay.io/keycloak/keycloak:22.0.3
      container_name: keycloak
      restart: always
      healthcheck:
        test: ["CMD", "curl", "http://localhost:8081/auth"]
        interval: 30s
        start_period: 2m
        retries: 10
      environment:
        DB_VENDOR: POSTGRES
        DB_ADDR: postgres
        DB_DATABASE: keycloak
        DB_USER: keycloak
        DB_SCHEMA: public
        DB_PASSWORD: keycloak
        # KEYCLOAK_USER: admin      #for wildfly distributions
        # KEYCLOAK_PASSWORD: admin    #for wildfly distributions
        KEYCLOAK_ADMIN: admin                #for quarkus
        KEYCLOAK_ADMIN_PASSWORD: admin        #for quarkus
        # Uncomment the line below if you want to specify JDBC parameters. The parameter below is just an example, and it shouldn't be used in production without knowledge. It is highly recommended that you read the PostgreSQL JDBC driver documentation in order to use it.
        #JDBC_PARAMS: "ssl=true"
      ports:
        - 8081:8080
      depends_on:
        - postgres
      networks:
      - kc-lite
      command:     #for quarkus
      - start-dev
networks:
  kc-lite:
    name: kc-lite
    driver: bridge

People doesn‘t seem to read the docs…
Same answer as this is valid here:

1 Like