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
然后,您只需将撰写文件中的服务
的命令
属性覆盖到--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屋!
查看全文