Keycloak 17 docker container : How to export/import realm? (import must be done on container startup)

I have been using the import feature with Keycloak 18.

You either:

  • prepare a custom image where you ran the kc.sh build as a dockerfile step and set ENTRYPOINT ["/opt/keycloak/bin/kc.sh","start", "--import-realm"]
    Your realm files should be at /opt/keycloak/data/import/
  • Use the official image with a custom entrypoint script where you kc.sh build and them kc.sh start --import-realm