How to set database address?

I’m currently trying to run keycloak in docker with an external database.
I’m following this link: Keycloak - Server - Running Keycloak in a container

I keep getting a “Connection to localhost:5432 refused” error but I never set my database address to localhost and I actually don’t see a database address env variable.
The only variable I see that could set the database address is KC_DB_URL and it’s set to the correct postgres container name.

So how do I actually set the database address in this new Quarkus version?
Is there any documentation or reference about these environment variables? I found a lot but for the WildFly version.

1 Like

I got it working by using this URL format: jdbc:postgresql://my-postgresql-host:5432/keycloak-database-name. It is described when you click to expand the db-url config option in the docs, which is a little bit hidden.


Using these settings worked for me (using MariaBD):
KC_DB: mariadb
KC_DB_URL: jdbc:mariadb://ip or container name:3306/keycloak
KC_DB_USERNAME: keycloak
KC_DB_PASSWORD: your password

1 Like

To: joerijansen,

Thank you so much!!!
Before I came across your example, I spent a lot of times.
Many of the examples explained by others, as you pointed out, explain the method applied in keycloak ver. 16 as an example, but the problem was solved by the way you pointed out.