keycloak-containers
keycloak-containers copied to clipboard
Alternative DB_PORT or DB_NAME Mysql is not authorized by Keycloak
Describe the bug
The connector jdbc used by keycloak dont wrapp the good port to connect at mysql
Version
jboss/keycloak 16.1.1
Expected behavior
The variable of configuration for the port of MYSQL in the docker_compose is defined at 3307. Normally Keyclocak must etablish the connection via this port. The same problem is for the DB-NAME variable.
Actual behavior
Connection failed The problem is similar with
- the variable DB_PORT : 3307. Keycloak used 3306
- the variable DB_NAME : mysql2. Keycloak used mysql "connection url" => expression "jdbc:mysql://${env.DB_ADDR:mysql}:${env.DB_PORT:3306}/${env.DB_DATABASE:keycloak}${env.JDBC_PARAMS:}", "driver-name" => "mysql", "flush-strategy" => "IdleConnections", "user-name" => expression "${env.DB_USER:keycloak}", "password" => expression "${env.DB_PASSWORD:mypasswd}", "check-valid-connection-sql" => "SELECT 1", "background-validation" => true, "background-validation-millis" => 60000L
How to Reproduce?
name: test-docker services: keycloak2: build: dockerfile: Dockerfile.keycloak depends_on: mysql2: condition: service_started deploy: restart_policy: condition: on-failure delay: 5s max_attempts: 3 window: 2m0s environment: DB_ADDR: 127.0.0.1 DB_DATABASE: keycloak DB_PASSWORD: thepasswd DB_PORT: "3307" DB_USER: keycloak DB_VENDOR: mysql JDBC_PARAMS: useSSL=false KEYCLOAK_PASSWORD: network KEYCLOAK_USER: admin image: quay.io/keycloak/keycloak:legacy networks: test-network: ipv4_address: 172.23.0.5 ports: - mode: ingress target: 8080 published: "8082" protocol: tcp mongodb2: build: dockerfile: Dockerfile.mongo container_name: mongo2 deploy: restart_policy: condition: on-failure delay: 5s max_attempts: 3 window: 2m0s environment: MONGO_INITDB_DATABASE: mybase MONGO_INITDB_PASSWORD: the passwd MONGO_INITDB_ROOT_PASSWORD: thepasswd MONGO_INITDB_ROOT_USERNAME: admin MONGO_INITDB_USERNAME: hello networks: test-network: ipv4_address: 172.23.0.2 ports: - mode: ingress target: 27017 published: "27018" protocol: tcp restart: always tty: true volumes: - type: bind docker/testNoSql/mongo-init.sh target: /docker-entrypoint-initdb.d/mongo-init.sh read_only: true bind: create_host_path: true - type: bind target: /data bind: create_host_path: true mysql2: build: context: /mnt/c/Users/f.sebbah/source/repos/Astrolab/lavoisier-livre-or/src/Services/Guestbook/Test-docker dockerfile: Dockerfile.mysql container_name: mysql2 deploy: restart_policy: condition: on-failure delay: 5s max_attempts: 3 window: 2m0s environment: MYSQL_DATABASE: keycloak MYSQL_PASSWORD: thepasswd MYSQL_ROOT_PASSWORD: thepasswd MYSQL_TCP_PORT: "3307" MYSQL_USER: keycloak expose: - "3307" networks: test-network: ipv4_address: 172.23.0.4 ports: - mode: ingress target: 3307 published: "3307" protocol: tcp restart: always tty: true volumes: - type: volume source: mysql2 target: /var/lib/mysql volume: {} - type: bind target: /docker-entrypoint-initdb.d/init.sql bind: create_host_path: true networks: test-network: name: test-network external: true volumes: mysql2: name: test-docker_mysql2 driver: local
Anything else?
No response