Abdalla Ismail
Abdalla Ismail

Reputation: 409

jar file with arguments in docker

Helo,

I have a java .jar file that takes a bunch of arguments as input when i run it from the terminal.I want to make a docker image and run it that contains the jar file where i can still pass the arguments for the jar file.

Upvotes: 7

Views: 17749

Answers (1)

jaxxstorm
jaxxstorm

Reputation: 13321

Set the jar file as your entrypoint and the args as your command

An example:

ENTRYPOINT ["/path/to/my/java.jar"]
CMD ["my", "default", "args"]

You can then override the args whenever you run the container, using:

docker run <my-docker-image> some custom args

More information here: http://goinbigdata.com/docker-run-vs-cmd-vs-entrypoint/

Upvotes: 9

Related Questions