0

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?

fuzzi
  • 1,967
  • 9
  • 46
  • 90
  • Your `docker run` command is different: your shell breaks it up into multiple "words", but the JSON-array `CMD` form has it all as one "word". You need to manually specify each word in the `CMD [...]`, or use the shell-form `CMD /keycloak-gatekeeper ...` without the square brackets. – David Maze May 10 '20 at 20:20

1 Answers1

1

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

user80867
  • 50
  • 1
  • 3