I've been trying to get keycloak running for a bit now. I had it going using the legacy tag but it seems like bad practice to get started with a legacy version. So I wanted to get the most recent version running. This is my docker compose config, but somehow It wont work. It has something todo with the database connection but I cant figure out what's going wrong.
version: '3'
volumes:
mysql_data2:
driver: local
services:
mysql:
container_name: keycloak_mysql
image: mysql:5.7
volumes:
- mysql_data2:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: MyRootPassword
MYSQL_DATABASE: keycloak
MYSQL_USER: keycloak
MYSQL_PASSWORD: MyKeycloakMySQLPassword
keycloak:
container_name: keycloak_keycloak
image: quay.io/keycloak/keycloak:22.0.3
environment:
KC_DB: MYSQL
KC_DB_URL_HOST: mysql
KC_DB_SCHEMA: keycloak
KC_DB_USERNAME: keycloak
KC_DB_PASSWORD: MyKeycloakMySQLPassword
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: MyKeycloakAdminPassword
KC_HOSTNAME_STRICT: "false"
KC_HTTP_RELATIVE_PATH: "/keycloak"
KC_PROXY: "edge"
ports:
- 8080:8080
- 8443:8443
depends_on:
- mysql
command:
- "start"