This simple project shows an example Docker configuration for Keycloak.
To learn how to set up a project like this one, check out the following articles:
- Keycloak in Docker #1 – How to run Keycloak in a Docker container
- Keycloak in Docker #2 – How to import a Keycloak realm
- Keycloak in Docker #3 – How to customise Keycloak themes
First, clone this repository.
Then, start the keycloak
and keycloakdb
containers with the following command:
docker-compose -f docker-compose-keycloak.yml up -d
Make sure that the keycloak
container is up. For instance, you can run the docker ps
command in your terminal:
The keycloak
service has a default realm imported from the
keycloak/realms/realm-export.json file that specifies all the default users.
Information about the import can be found in the container logs when the service is started for the first time:
Below you'll find a list of default user accounts.
- username:
keycloak
- password:
keycloak
- usernames:
christina
,hanna
,carlo
,noel
- password:
test
- realm role:
user
- Visit the https://localhost:8024/auth url:
- Select the
Administration Console
option and log in as the Keycloak admin [keycloak:keycloak
]:
- As an admin you can see a list of users associated with the
Example-Realm
realm by clicking theView all users
button on the https://localhost:8024/auth/admin/master/console/#/realms/Example-Realm/users page. - What's more, you can log in as any user associated with the
Example-Realm
realm by clicking theSign in
button on the https://localhost:8024/auth/realms/Example-Realm/account page. - The realm roles are available under the https://localhost:8024/auth/admin/master/console/#/realms/Example-Realm/roles url.
- Dockerized Keycloak server and its PostgreSQL database
- Default Example-Realm is imported when the
keycloak
container starts - Keycloak themes are customized for the Login and Account types:
The Keycloak theme caching is disabled to allow for fast and convenient theme editing. Remember to re-enable caching in
production as it will significantly impact performance. To do this, remove the
- ./keycloak/scripts/disable-theme-cache.cli:/opt/jboss/startup-scripts/disable-theme-cache.cli
volume from the
docker-compose-keycloak.yml file.