Skip to content

Instantly share code, notes, and snippets.

@ulrich
Created December 13, 2024 15:50
Show Gist options
  • Save ulrich/a0d0f449f139378e12a9e6d18961084f to your computer and use it in GitHub Desktop.
Save ulrich/a0d0f449f139378e12a9e6d18961084f to your computer and use it in GitHub Desktop.

Export Keycloak realms and users from H2 database

docker exec -it my_keycloak sh -c \
  "cp -rp /opt/keycloak/data/h2 /tmp ; \
  /opt/keycloak/bin/kc.sh export --dir /opt/keycloak/data/import --realm MY_REALM \
    --db dev-file \
    --db-url 'jdbc:h2:file:/tmp/h2/keycloakdb;NON_KEYWORDS=VALUE'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment