How to persist data in keycloak docker

This is pretty simple. I noticed that when I restart the development service, my keycloak realm disappears. It is simply a matter of having an appropriate bind volume, to persist it:

version: '3.2'

services:

  keycloak_development:
    image: quay.io/keycloak/keycloak
    volumes:
      - type: bind
        source: ./volumes/keycloak_development
        target: /opt/keycloak/data
    ports:
      - 8010:8080 ## host:docker
    restart: always
    command: start-dev
    environment:
      KEYCLOAK_ADMIN: admin
      KEYCLOAK_ADMIN_PASSWORD: test1234

Please login or register to post a comment.