在docker中带参数的jar文件 [英] jar file with arguments in docker
本文介绍了在docker中带参数的jar文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Helo,
我有一个java .jar文件,当我从终端运行它时需要一堆参数作为输入。我想制作一个docker镜像并运行它包含jar文件,我仍然可以传递jar文件的参数。
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.
推荐答案
Set the jar file as your entrypoint and the args as your command
示例:
ENTRYPOINT ["/path/to/my/java.jar"]
CMD ["my", "default", "args"]
然后,您可以在运行容器时覆盖args,使用:
You can then override the args whenever you run the container, using:
docker run <my-docker-image> some custom args
更多信息: http://goinbigdata.com/docker-run-vs-cmd-vs-entrypoint/
这篇关于在docker中带参数的jar文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文