我在docker上运行keycloak,我想导入一个以前导出的领域,但是我得到错误:启动时出错:org.keycloak.models.ModelException:hashAlgorithm的配置无效:未找到密码哈希提供程序我了解到需要将jbcrypt.jar复制到容器的standalone/deployments文件夹中。然后我使用创建了一个Dockerfile,以便可以复制jbcrypt。请问如何为bcrypt提供密码哈希提供程序?
停靠文件:
FROM jboss/keycloak:latest
ARG KEYCLOAK_HOME=/opt/jboss/keycloak
RUN curl -L https://github.com/leroyguillaume/keycloak-bcrypt/releases/download/1.5.0/keycloak-bcrypt-1.5.0.jar > $KEYCLOAK_HOME/standalone/deployments/keycloak-bcrypt-1.5.0.jar
RUN curl -L https://repo1.maven.org/maven2/org/mindrot/jbcrypt/0.4/jbcrypt-0.4.jar > $KEYCLOAK_HOME/standalone/deployments/jbcrypt-0.4.jar
RUN cd $KEYCLOAK_HOME/standalone/deployments/ && ls
RUN /opt/jboss/keycloak/bin/jboss-cli.sh --command="module add --name=org.mindrot.jbcrypt --resources=$KEYCLOAK_HOME/standalone/deployments/jbcrypt-0.4.jar"
RUN /opt/jboss/keycloak/bin/jboss-cli.sh --command="module add --name=org.mindrot.keycloakbcrypt --resources=$KEYCLOAK_HOME/standalone/deployments/keycloak-bcrypt-1.5.0.jar"
停靠-撰写.yml
version: '3'
volumes:
postgres_data:
driver: local
services:
ncbs_core_keycloak_postgres:
image: postgres:latest
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
POSTGRES_DB: keycloak
POSTGRES_USER: keycloak
POSTGRES_PASSWORD: password
restart: always
ncbs_core_keycloak:
# image: jboss/keycloak:latest
build: .
environment:
DB_VENDOR: POSTGRES
DB_ADDR: ncbs_core_keycloak_postgres
DB_DATABASE: keycloak
DB_USER: keycloak
DB_SCHEMA: public
DB_PASSWORD: password
KEYCLOAK_USER: admin
KEYCLOAK_PASSWORD: admin
KEYCLOAK_IMPORT: ./imports/realm-export.json
# 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"
command:
- "-b 0.0.0.0"
- "-Dkeycloak.migration.action=import"
- "-Dkeycloak.migration.provider=singleFile"
- "-Dkeycloak.migration.file=/opt/jboss/keycloak/imports/realm-export.json"
- "-Dkeycloak.migration.strategy=OVERWRITE_EXISTING"
volumes:
- ./imports:/opt/jboss/keycloak/imports
ports:
- 8080:8080
depends_on:
- ncbs_core_keycloak_postgres
1条答案
按热度按时间lsmepo6l1#
我已经在docker-compose中使用了卷,让它在不重新启动的情况下工作从GitHub下载lib并安装为卷,如下所示: