I want to pass in a parameter into a docker CMD. For example, if the contents of Dockerfile
are
FROM ubuntu:15.04
CMD ["/bin/bash", "-c", "cat", "$1"]
Then I want to run as follows:
docker build -t cat_a_file .
docker run -v `pwd`:/data cat_a_file /data/Dockerfile
I would like the contents of Dockerfile
to be printed to the screen. But instead, Docker thinks that /data/Dockerfile
is a script that should override the CMD
, giving the error
Error response from daemon: Cannot start container 7cfca4:
[8] System error: exec: "/data/Dockerfile": permission denied
How can this be avoided?