Skip to content

Commit

Permalink
enhance container guide
Browse files Browse the repository at this point in the history
closes #10458
  • Loading branch information
DGuhr authored and stianst committed Feb 25, 2022
1 parent af7a040 commit 45c0baf
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion docs/guides/src/main/server/containers.adoc
Expand Up @@ -62,7 +62,7 @@ podman|docker build . -t prebuilt_keycloak
To start the image, run:
[source, bash]
----
podman|docker run --name optimized_keycloak -p 8443:8443 prebuilt_keycloak
podman|docker run --name optimized_keycloak -p 8443:8443 -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=change_me prebuilt_keycloak
----
Keycloak starts in production mode, using only secured HTTPS communication, and is available on `https://localhost:8443`.
Notice that the startup log contains the following line:
Expand Down Expand Up @@ -117,4 +117,18 @@ In the example, the line `--db=postgres --features=token-exchange` sets the dat
Keycloak then starts up and applies the configuration for the specific environment.
This approach significantly increases startup time and creates an image that is mutable, which is not the best practice.

== Provide initial admin credentials when running in a container
Keycloak only allows to create the initial admin user from a local network connection. This is not the case when running in a container, so you have to provide the following environment variables when you run the image:

[source, bash]
----
# setting the admin username
-e KEYCLOAK_ADMIN=<admin-user-name>
# setting the initial password
-e KEYCLOAK_ADMIN_PASSWORD=change_me
----

Feel free to join the open https://github.com/keycloak/keycloak/discussions/8549[GitHub Discussion] around enhancements of the admin bootstrapping process.

</@tmpl.guide>

0 comments on commit 45c0baf

Please sign in to comment.