Import Realm with docker-compose setup

Is there a way to import a Realm with env_variables like KEYCLOAK_IMPORT.

But keycloak_import seems to be deprecated.

I´m using KC_FILE, with a mounted file, but this does not work.

It’s all in there… in the docs/guides!

Ok so the solution is changing the docker-compose to:

command:
   start --import-realm

and mount the realm in /opt/keycloak/data/import

Thanks so far!

But why is there an env KC_FILE? Is it to import on build but not on startup?

Not on build and not on start, it’s only for export and import.