I tried everything I could find in other related posts but Keycloak admin console that is running on a local docker image is not loading.
There is an infinite spinner with the text: Loading the Admin UI
I am guessing somewhere in my docker-compose.yml
file is an error that I can not find.
If someone had a similar issue, please help me solve it.
version: '3'
services:
nginx:
image: nginx:latest
ports:
- "80:80"
volumes:
- "./docker-configs/nginx.conf:/etc/nginx/conf.d/default.conf"
- ".:/app:cached"
php:
build:
context: ./docker-configs/php
volumes:
- "./docker-configs/php/php.ini:/usr/local/etc/php/conf.d/php.ini"
- ".:/app:cached"
environment:
PHP_IDE_CONFIG: "serverName=Docker"
database:
image: mysql:8.1.0
platform: linux/amd64
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: best_db
MYSQL_PASSWORD: root
ports:
- '3306:3306'
volumes:
- ./mysql-data:/var/lib/mysql
keycloak:
image: quay.io/keycloak/keycloak:22.0
# restart: unless-stopped
environment:
KC_HTTP_ENABLED: 'true'
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: admin
KC_DB_URL_HOST: database
KC_DB_URL_DATABASE: keycloak
KC_DB_USERNAME: keycloak
KC_DB_PASSWORD: keycloak
KC_HOSTNAME: keycloak
KC_DB_URL_PORT: 3306
KC_HOSTNAME_STRICT: 'false'
KC_HOSTNAME_STRICT_HTTPS: 'false'
KC_TRANSACTION_XA_ENABLED: 'false'
command: '-v start-dev --import-realm'
depends_on:
- database
ports:
- '8080:8080'
- '8443:8443'
2
Answers
Keycloak needs to be able to access the database.
This error isn’t super obvious because the logs don’t give you a lot of information.
However if you adjust to match the user/password you create in the database part of your yaml to the user/password you’re using in the keycloak part, you’ll be fine.
So it needs to look something like
I had to comment – KC_HOSTNAME option out in docker-compose file and it worked after that. (Based on the hint here: https://www.reddit.com/r/homelab/comments/yzn476/keycloak_in_docker_endless_look_at_admin_console/ ) Can’t explain WHY…