Answer the question
In order to leave comments, you need to log in
How to pass arguments to an external file in Docker?
I have an executable program in Docker that needs to be passed arguments to parse a file (read-only). Similar to the file program.
Started with this Dockerfile
FROM alpine:3.7
ADD ./trid /usr/local/bin
Answer the question
In order to leave comments, you need to log in
If /usr/local/bin/trid is defined as ENTRYPOINT then CMD will be provided as options for ENTRYPOINT.
When starting the container, you can override CMD, in our case, specify the path to the file for analysis inside the container.
Therefore, you need to mount the external folder with files into the container.
# dockerfile
---
FROM alpine:3.7
ADD ./trid /usr/local/bin
ENTRYPOINT ["/usr/local/bin/trid"]
---
docker build -t trid:v1 .
/var/lib/docker_data/files/file1.txt
/var/lib/docker_data/files/file2.txt
/var/lib/docker_data/files/file3.txt
docker run --rm -v /var/lib/docker_data/files:/data:ro --name analysis trid:v1 "/data/file1.txt"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question