I am trying to setup containers with keycloak postgres, but as long as the KC_DB
en variable is set to postgres
, then KC_DB_HOST
nor KC_DB_URL
seems to have any effect, and he startup fails with can't connect to localhost:5432
.
Here is the docker-compose.yml :
services:
db-keycloak:
image: postgres:latest
volumes:
- "./_me_data/db-keycloak:/var/lib/postgresql/data"
environment:
POSTGRES_DB: keycloak
POSTGRES_USER: keycloak
POSTGRES_PASSWORD: keycloak
keycloak:
image: quay.io/keycloak/keycloak:latest
ports:
- "8082:8080"
command: start-dev
environment:
KC_DB: postgres
# KC_DB_URL=jdbc:postgres://db-keycloak:5432/keycloak
KC_DB_HOST: db-keycloak
KC_DB_USERNAME: keycloak
KC_DB_PASSWORD: keycloak
KEYCLOAK_ADMIN: root
KEYCLOAK_ADMIN_PASSWORD: oooo
CodePudding user response:
Replace KC_DB_HOST
with KC_DB_URL_HOST
(see Docs)