I'm having trouble enabling certain features in my custom Keycloak Docker image—specifically scripts
, impersonation
, and passkeys
. Despite following the recommended steps, these features aren't available in the final image.What I've done:
KC_FEATURES=scripts,impersonation,passkeys
.A simplified version od my Dockerfile:
# Stage 1: Building Keycloak with features
FROM quay.io/keycloak/keycloak:${KEYCLOAK_VERSION} AS builder
ENV KC_FEATURES=scripts,impersonation,passkeys
RUN /opt/keycloak/bin/kc.sh build
# Stage 2: Final image
FROM quay.io/keycloak/keycloak:${KEYCLOAK_VERSION}
COPY --from=builder /opt/keycloak/providers/ /opt/keycloak/providers/
CMD ["/opt/keycloak/bin/kc.sh", "start", "--optimized", "--cache=ispn", "--verbose"]
The Issue:
/opt/keycloak/providers/
in the running container, it only contains README.md./opt/keycloak/bin/kc.sh show-config
, it shows that the features are activated: kc.features = scripts,impersonation,passkeys (ENV)
Installed features: [agroal, cdi, hibernate-orm, jdbc-mysql, keycloak, logging-gelf, micrometer, narayana-jta, reactive-routes, resteasy-reactive, resteasy-reactive-jackson, smallrye-context-propagation, smallrye-health, vertx]
Has anyone encountered this issue or knows how to properly include these features in the final image?
/opt/keycloak/providers/
is the path for custom providers (JAR files), and the /opt/keycloak/lib/quarkus/
path is the directory that contains the stuff after the build, therefore
# Stage 1: Building Keycloak with features
FROM quay.io/keycloak/keycloak:${KEYCLOAK_VERSION} AS builder
# If you have custom providers
COPY /service-providers-jars /opt/keycloak/providers/
ENV KC_FEATURES=scripts,impersonation,passkeys
RUN /opt/keycloak/bin/kc.sh build
# Stage 2: Final image
FROM quay.io/keycloak/keycloak:${KEYCLOAK_VERSION}
# copy the whole /opt/keycloak/
COPY --from=builder /opt/keycloak/ /opt/keycloak/
CMD ["/opt/keycloak/bin/kc.sh", "start", "--optimized", "--cache=ispn", "--verbose"]
Or if you want, the COPY
line can be in the for of
COPY --from=builder /opt/keycloak/providers/ /opt/keycloak/providers/
COPY --from=builder /opt/keycloak/lib/quarkus/ /opt/keycloak/lib/quarkus/