Docker Compose JVM 参数 [英] Docker Compose JVM parameters
本文介绍了Docker Compose JVM 参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我编写了一个 Java 应用程序,它接受一个环境变量,该变量接受一个参数来为 JWT 令牌盐键设置一个键.有没有办法让我在 Docker Compose 中传递命令变量?
I wrote a java application that takes an environment variable that takes an argument to set a key for a JWT token salt key. Is there a way for me to pass the command variables in Docker Compose?
java -Djava.security.egd=file:/dev/./urandom -jar /user-profile-api.jar --key=blah
运行docker镜像你只需
And to run the docker image you just
docker run -p 8080:8080 docker_image --key=blah
推荐答案
如果您已经能够使用以下方法运行您的 docker 容器:
If you already are able to run your docker container using:
docker run -p 8080:8080 docker_image --key=blah
然后,您只需要将撰写文件中 service
的 command
属性覆盖为 --key=blah.所以:
Then you just need to override the command
attribute for your service
in the compose file to --key=blah. So:
services:
app:
command: --key=blah
...
这篇关于Docker Compose JVM 参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文