在Docker中运行Keycloak时出错 [英] Error when running Keycloak in Docker
问题描述
我正在尝试在Docker中运行Keycloak,但是它引发了错误.
I am trying to run Keycloak in Docker, but its throwing an error.
这是docker文件:
Here's the docker file:
FROM jboss/keycloak:4.1.0.Final
WORKDIR /opt/jboss/keycloak
COPY realm-export.json initial_data.json
RUN ./bin/standalone.sh -Dkeycloak.migration.action=import -Dkeycloak.migration.provider=singleFile -Dkeycloak.migration.file=initial_data.json -Dkeycloak.migration.strategy=OVERWRITE_EXISTING
我正在使用该realm-export.json文件,因为那里有一些配置. 而显示的错误就是这个:
I am using that realm-export.json file because I have some configurations there. And the error that is showing is this one:
12:04:35,033 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 48) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./auth: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./auth: java.lang.RuntimeException: RESTEASY003325: Failed to construct public org.keycloak.services.resources.KeycloakApplication(javax.servlet.ServletContext,org.jboss.resteasy.core.Dispatcher)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:84)
Caused by: java.lang.RuntimeException: RESTEASY003325: Failed to construct public org.keycloak.services.resources.KeycloakApplication(javax.servlet.ServletContext,org.jboss.resteasy.core.Dispatcher)
Caused by: java.lang.RuntimeException: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "typedScopes" (class org.keycloak.representations.idm.authorization.ResourceRepresentation), not marked as ignorable (11 known properties: "ownerManagedAccess", "owner", "icon_uri", "attributes", "type", "name", "uri", "displayName", "scopes", "resource_scopes", "_id"])
at [Source: java.io.FileInputStream@6d0b4fbd; line: 690, column: 29] (through reference chain: org.keycloak.representations.idm.RealmRepresentation["clients"]->java.util.ArrayList[2]->org.keycloak.representations.idm.ClientRepresentation["authorizationSettings"]->org.keycloak.representations.idm.authorization.ResourceServerRepresentation["resources"]->java.util.ArrayList[2]->org.keycloak.representations.idm.authorization.ResourceRepresentation["typedScopes"])
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "typedScopes" (class org.keycloak.representations.idm.authorization.ResourceRepresentation), not marked as ignorable (11 known properties: "ownerManagedAccess", "owner", "icon_uri", "attributes", "type", "name", "uri", "displayName", "scopes", "resource_scopes", "_id"])
at [Source: java.io.FileInputStream@6d0b4fbd; line: 690, column: 29] (through reference chain: org.keycloak.representations.idm.RealmRepresentation["clients"]->java.util.ArrayList[2]->org.keycloak.representations.idm.ClientRepresentation["authorizationSettings"]->org.keycloak.representations.idm.authorization.ResourceServerRepresentation["resources"]->java.util.ArrayList[2]->org.keycloak.representations.idm.authorization.ResourceRepresentation["typedScopes"])
这在结尾处显示:
12:04:35,121 ERROR [org.jboss.as.server] (ServerService Thread Pool -- 45) WFLYSRV0022: Deploy of deployment "keycloak-server.war" was rolled back with no failure message
ERROR: Service 'keycloak' failed to build: The command '/bin/sh -c ./bin/standalone.sh -Dkeycloak.migration.action=import -Dkeycloak.migration.provider=singleFile -Dkeycloak.migration.file=initial_data.json -Dkeycloak.migration.strategy=OVERWRITE_EXISTING' returned a non-zero code: 1
p.s.当我在DockerFile中注释此代码时
p.s. When I comment this code in DockerFile
RUN ./bin/standalone.sh -Dkeycloak.migration.action=import -Dkeycloak.migration.provider=singleFile -Dkeycloak.migration.file=initial_data.json -Dkeycloak.migration.strategy=OVERWRITE_EXISTING
然后它执行得很好,但是我确实需要在此处添加该realm-export.json文件.
Then it is executing perfectly, but I do need to add that realm-export.json file here.
推荐答案
typedScopes
从4.0.0版本更改为scopes
,您的realm-export.json文件是从旧版本的keycloak生成的
typedScopes
is changed to scopes
from 4.0.0 version, you realm-export.json file is generated from older version of keycloak
这篇关于在Docker中运行Keycloak时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!