Hi, I’m trying to connect from a dockerized keycloak to an external not dockerized Postgres DB schema, but I’m having a TimeOut after 300s, It seems Keycloak on Docker is not being able to establish a connection with Postgres.
I’d like to know if there is some special configuration on docker-compose or somewhere else to connect Keycloak from Docker to an External Postgres DB.
docker-compose.yml:
version: '3'
services:
keycloak:
image: quay.io/keycloak/keycloak:latest
environment:
DB_VENDOR: postgres
DB_ADDR: 10.235.246.237
DB_PORT: 5433
DB_DATABASE: keycloak
DB_USER: postgres
DB_SCHEMA: authentication
DB_PASSWORD: #removed
KEYCLOAK_USER: admin
KEYCLOAK_PASSWORD: #removed
KEYCLOAK_LOGLEVEL: DEBUG
# Uncomment the line below if you want to specify JDBC parameters. The parameter below is just an example, and it shouldn't be used in production without knowledge. It is highly recommended that you read the PostgreSQL JDBC driver documentation in order to use it.
#JDBC_PARAMS: "ssl=true"
ports:
- 8080:8080
- 8443:8443
Error message during startup:
keycloak_1 | 20:44:44,383 INFO [org.keycloak.services] (ServerService Thread Pool -- 65) KC-SERVICES0050: Initializing master realm
keycloak_1 | 20:46:42,915 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0348: Timeout after [300] seconds waiting for service container stability. Operation will roll back. Step that first updated the service container was 'add' at address '[
keycloak_1 | ("core-service" => "management"),
keycloak_1 | ("management-interface" => "http-interface")
keycloak_1 | ]'
keycloak_1 | 20:46:47,917 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0190: Step handler org.jboss.as.server.DeployerChainAddHandler$FinalRuntimeStepHandler@54e0d88a for operation add-deployer-chains at address [] failed -- java.util.concurrent.TimeoutException: java.util.concurrent.TimeoutException
keycloak_1 | at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.OperationContextImpl.waitForRemovals(OperationContextImpl.java:525)
keycloak_1 | at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.AbstractOperationContext$Step.handleResult(AbstractOperationContext.java:1559)
keycloak_1 | at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.AbstractOperationContext$Step.finalizeInternal(AbstractOperationContext.java:1513)
keycloak_1 | at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.AbstractOperationContext$Step.finalizeStep(AbstractOperationContext.java:1496)
keycloak_1 | at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.AbstractOperationContext$Step.access$400(AbstractOperationContext.java:1360)
keycloak_1 | at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.AbstractOperationContext.executeResultHandlerPhase(AbstractOperationContext.java:912)
keycloak_1 | at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.AbstractOperationContext.processStages(AbstractOperationContext.java:762)
keycloak_1 | at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:468)
keycloak_1 | at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.OperationContextImpl.executeOperation(OperationContextImpl.java:1415)
keycloak_1 | at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.ModelControllerImpl.boot(ModelControllerImpl.java:529)
keycloak_1 | at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.AbstractControllerService.boot(AbstractControllerService.java:515)
keycloak_1 | at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.AbstractControllerService.boot(AbstractControllerService.java:477)
keycloak_1 | at org.jboss.as.server@15.0.1.Final//org.jboss.as.server.ServerService.boot(ServerService.java:459)
keycloak_1 | at org.jboss.as.server@15.0.1.Final//org.jboss.as.server.ServerService.boot(ServerService.java:412)
keycloak_1 | at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:416)
keycloak_1 | at java.base/java.lang.Thread.run(Thread.java:829)
keycloak_1 |
keycloak_1 | 20:46:47,918 ERROR [org.jboss.as.controller.client] (Controller Boot Thread) WFLYCTL0190: Step handler org.jboss.as.server.DeployerChainAddHandler$FinalRuntimeStepHandler@54e0d88a for operation add-deployer-chains at address [] failed -- java.util.concurrent.TimeoutException
keycloak_1 | 20:46:47,920 INFO [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0008: Undertow HTTPS listener https suspending
keycloak_1 | 20:46:47,923 INFO [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0007: Undertow HTTPS listener https stopped, was bound to 0.0.0.0:8443
keycloak_1 | 20:46:48,875 WARN [com.arjuna.ats.arjuna] (Transaction Reaper) ARJUNA012117: TransactionReaper::check timeout for TX 0:ffffac1e0002:6cd97fb7:61537e06:e in state RUN
keycloak_1 | 20:46:48,881 WARN [com.arjuna.ats.arjuna] (Transaction Reaper Worker 0) ARJUNA012121: TransactionReaper::doCancellations worker Thread[Transaction Reaper Worker 0,5,main] successfully canceled TX 0:ffffac1e0002:6cd97fb7:61537e06:e
keycloak_1 | 20:46:52,919 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0190: Step handler org.jboss.as.domain.management.security.SecurityRealmAddHandler$ServiceInstallStepHandler@5ce2baae for operation add at address [
keycloak_1 | ("core-service" => "management"),
keycloak_1 | ("security-realm" => "ApplicationRealm")
keycloak_1 | ] failed -- java.util.concurrent.TimeoutException: java.util.concurrent.TimeoutException
keycloak_1 | at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.OperationContextImpl.waitForRemovals(OperationContextImpl.java:525)