dockerdockerfilekeycloakbitnamikeycloak-gatekeeper

Docker command runs successfully from Docker run, but not when using CMD in Dockerfile


I am wrapping the Bitnami/Keycloak-Gatekeeper Docker image in a Dockerfile, and trying to run:

FROM bitnami/keycloak-gatekeeper:latest
COPY config.yml /opt/bitnami/keycloak-gatekeeper/config.yml
CMD ["/keycloak-gatekeeper --config /opt/bitnami/keycloak-gatekeeper/config.yml"]

This gives an error:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:346: starting container process caused "exec: \"/keycloak-gatekeeper --config /opt/bitnami/keycloak-gatekeeper/config.yml\": stat /keycloak-gatekeeper --config /opt/bitnami/keycloak-gatekeeper/config.yml: no such file or directory": unknown.

However, when I run this using a docker run command, everything executes as expected.

docker run -v "config.yml:/opt/bitnami/keycloak-gatekeeper/config.yml" bitnami/keycloak-gatekeeper:latest /keycloak-gatekeeper --config /opt/bitnami/keycloak-gatekeeper/config.yml

Why does this work directly through docker run, and not within the Dockerfile?

How can I solve this issue so that I can run using the Dockerfile?


Solution

  • CMD ["keycloak-gatekeeper", "--config", "/opt/bitnami/keycloak-gatekeeper/config.yml"]