Answer the question
In order to leave comments, you need to log in
How to pass parameters to a container in Docker?
I have a phantomjs script.
I need to run this script in a container and pass parameters to this script.
In php, I ran it like this:
...
exec("phantomjs test.js $p1 $p2 $p3 $p4", $result);
...
# our base image
FROM wernight/phantomjs:latest
# copy our application code
ADD test.js /tmp/test.js
WORKDIR /tmp
# specify the port number the container should expose
EXPOSE 5000
# run the application
CMD ["phantomjs", "./test.js"]
Answer the question
In order to leave comments, you need to log in
Delete from Dockerfile CMD.
Collect an image.
And run like this:sudo docker run imagename phantomjs test.js param
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question