diff --git a/docs/guides/src/main/server/containers.adoc b/docs/guides/src/main/server/containers.adoc index 48f8eed2b94..9f8139efcd6 100644 --- a/docs/guides/src/main/server/containers.adoc +++ b/docs/guides/src/main/server/containers.adoc @@ -155,6 +155,19 @@ Keycloak only allows to create the initial admin user from a local network conne -e KEYCLOAK_ADMIN_PASSWORD=change_me ---- +== Importing A Realm On Startup + +The https://quay.io/keycloak/keycloak[published Keycloak containers] have a directory `/opt/keycloak/data/import`. If you put one or more import files in that directory via a volume mount or other means and add the startup argument `--import-realm`, the Keycloak container will import that data on startup! This may only make sense to do in Dev mode. + +[source, bash] +---- +podman|docker run --name keycloak_unoptimized -p 8080:8080 \ + -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=change_me \ + -v /path/to/realm/data:/opt/keycloak/data/import + quay.io/keycloak/keycloak:latest \ + start-dev --import-realm +---- + Feel free to join the open https://github.com/keycloak/keycloak/discussions/8549[GitHub Discussion] around enhancements of the admin bootstrapping process. diff --git a/docs/guides/src/main/server/importExport.adoc b/docs/guides/src/main/server/importExport.adoc index c36a71e6ec8..15ce94e4c34 100644 --- a/docs/guides/src/main/server/importExport.adoc +++ b/docs/guides/src/main/server/importExport.adoc @@ -82,6 +82,8 @@ You are also able to import realms when the server is starting by using the `--i When you set the `--import-realm` option, the server is going to try to import any realm configuration file from the `data/import` directory. Each file in this directory should contain a single realm configuration. Only regular files using the `.json` extension are read from this directory, sub-directories are ignored. +NOTE: For the https://quay.io/keycloak/keycloak[published containers], the import directory is `/opt/keycloak/data/import` + If a realm already exists in the server, the import operation is skipped. === Using Environment Variables within the Realm Configuration Files