I’m using docker swarm and setting up a fresh copy of keycloak 20 and ran into some issues.
I’ve been using an older version of Keycloak but seems that the startup configuration etc has changed, especially for docker.
My docker-compose.yml looks like this current ly:
keycloak:
image: quay.io/keycloak/keycloak:20.0
environment:
TZ: '...'
KC_HOSTNAME: localhost
KC_HOSTNAME_PORT: 80
KC_HOSTNAME_STRICT_BACKCHANNEL: "true"
KC_DB: mysql
KC_DB_URL: jdbc:mysql://mysql:3306/keycloak
KC_DB_USERNAME: ${KEYCLOAK_DB_USER}
KC_DB_PASSWORD: ${KEYCLOAK_DB_PASSWORD}
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_PASSWORD}
KC_HEALTH_ENABLED: "true"
KC_LOG_LEVEL: info
volumes:
- ./keycloak_realms:/realm-config # <- Unclear???
depends_on:
- mysql-db
networks:
- mysql-net
- web
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8080/health/ready" ]
interval: 15s
timeout: 2s
retries: 15
deploy:
resources:
limits:
cpus: '0.50'
memory: 512m
When I start the container, all I see is an documentation for a kc.sh
shell script.
I also cannot find a documentation about the new volume location etc.
In total I have an issue with lack of documentation and how to debug.
Has anyone more information about the config and how what is wrong here?
2
Answers
Your configuration is substantially correct, but you need to provide an argument to the
kc.sh
command. As you see from the help output, your options are:You probably want
start-dev
, so:I wasn’t able to get things running using
KC_DB: mysql
(this resulted in the errorUnknown database: MySQL
), but using MariaDB worked fine. The following configuration successfully starts Keycloak:With that configuration, I can access keycloak at http://localhost:8080 and log into the admin console.
FYI: In Keycloak 21 new micro base image is used , so ‘curl’ no longer included in Image so healthcheck will not work anymore.
If Keycloak configured without HTTPS my workaround is this: