How to pass command line arguments to a docker image

docker

Solution

You can build your Dockerfile with a combination of `ENTRYPOINT` and `CMD` instructions, which will let you run containers with or without arguments, e.g:

FROM ubuntu
ENTRYPOINT ["/bin/echo"]
CMD ["hello"]

That says the entrypoint is the `echo` command, and the default argument is `hello`. Run a container with no arguments:

> docker run temp
hello  

Run with arguments and they all get passed to the entrypoint command:

> docker run temp -s stackoverflow
-s stackoverflow

Problem

I run tests inside docker image and I need to pass custom arguments all the time. When I put arguments after image name docker thinks that argument is image name. ``` docker run -t -i image-name -s test.py docker run -t -i image-name -- -s test.py ``` Error: ``` Failed no image test_arena2.py ``` Docker version 1.11.2, build b9f10c9

Original source