3

I have bundled a custom theme as part of keycloak docker image. On starting the keycloak cluster, the custom theme need to be set in master realm.

How can I configure the master realm to set with custom theme?

dreamcrash
  • 47,137
  • 25
  • 94
  • 117
sreekesh.s
  • 158
  • 1
  • 8

2 Answers2

3

From the Admin Console, after you have correctly deployed everything, you just need to go:

  • The Master Realm;
  • Realm Settings;
  • Select Themes;
  • And then select your custom theme for each theme type (e.g., Login Theme) that you want to change;

This can be done using the Keycloak Admin CLI

./kcadm update realms/masterE -s "loginTheme=<YOUR_CUSTOM_THEME>"

to use that script you have to authenticate yourself first:

 ./kcadm config credentials --server <KEYCLOAK_HOST>auth --realm master --user admin --password <ADMIN_PASSOWRD>

You can add these commands into your docker configuration. Another option that you have, is to just override the folder that contains the base theme with your custom theme. Therefore, the default theme would be your custom theme. You can make a copy of the base theme with a different name, so that you can also explicitly selected if needed.

dreamcrash
  • 47,137
  • 25
  • 94
  • 117
1

With the official Keycloak images from the docker hub you can pass an environment variable KEYCLOAK_DEFAULT_THEME to use a custom theme, provided it is residing in /opt/jboss/keycloak/themes/:

docker run -d -p 8080:8080 -v ./my-realm.json:/tmp/my-realm.json -v ./my-awesome-theme:/opt/jboss/keycloak/themes/my-awesome-theme -e KEYCLOAK_DEFAULT_THEME=my-awesome-theme -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=p@ssw0rd -e KEYCLOAK_IMPORT=/tmp/my-realm.json jboss/keycloak
KMZ
  • 463
  • 3
  • 12