Docker Community Forums

Share and learn in the Docker community.

Getting error could not locate file if fileName is written in camelcase in params of CMD in dockerfile

I am providing filename as envParams.json in params of CMD in dockefile but when I run it I get below error

ERROR: Could not locate file envparams.json, Provide the environment parameters file on command line in the form .json

If I rename the file to envparams.json it is working.

How do I resolve this issue?

I have used ADD in docker file to ADD envParams.json and it is getting added to container also.
Even I tried using cat envParams.json and cat > envParams.json which is also working.
But while running it is searching for envparams.json

To use a file in the build context, the Dockerfile refers to the file specified in an instruction, for example, a COPY instruction. To increase the build’s performance, exclude files and directories by adding a .dockerignore file to the context directory. For information about how to create a .dockerignore file see the documentation on this page.

Traditionally, the Dockerfile is called Dockerfile and located in the root of the context. You use the -f flag with docker build to point to a Dockerfile anywhere in your file system.

$ docker build -f /path/to/a/Dockerfile .
You can specify a repository and tag at which to save the new image if the build succeeds:

$ docker build -t shykes/myapp .
To tag the image into multiple repositories after the build, add multiple -t parameters when you run the build command:

$ docker build -t shykes/myapp:1.0.2 -t shykes/myapp:latest .
Before the Docker daemon runs the instructions in the Dockerfile, it performs a preliminary validation of the Dockerfile and returns an error if the syntax is incorrect:

$ docker build -t test/myapp .

Sending build context to Docker daemon 2.048 kB
Error response from daemon: Unknown instruction: RUNCMD
The Docker daemon runs the instructions in the Dockerfile one-by-one, committing the result of each instruction to a new image if necessary, before finally outputting the ID of your new image. The Docker daemon will automatically clean up the context you sent.

Note that each instruction is run independently, and causes a new image to be created - so RUN cd /tmp will not have any effect on the next instructions.

Whenever possible, Docker will re-use the intermediate images (cache), to accelerate the docker build process significantly. This is indicated by the Using cache message in the console output. (For more information, see the Dockerfile best practices guide:

$ docker build -t svendowideit/ambassador .

Sending build context to Docker daemon 15.36 kB
Step 1/4 : FROM alpine:3.2
—> 31f630c65071
—> Using cache
—> 2a1c91448f5f
Step 3/4 : RUN apk update && apk add socat && rm -r /var/cache/
—> Using cache
—> 21ed6e7fbb73
Step 4/4 : CMD env | grep _TCP= | (sed ‘s/.PORT([0-9])_TCP=tcp://(.):(.)/socat -t 100000000 TCP4-LISTEN:\1,fork,reuseaddr TCP4:\2:\3 &/’ && echo wait) | sh
—> Using cache
—> 7ea8aef582cc
Successfully built 7ea8aef582cc

It seems the reply above to be a bot… not sure. Anyways:

Suggestion: why don’t you try to run envParams.json instead of the lowercase version? Linux is case sensitive.