[英]Spring boot with docker build mvn spring-boot:build-image with jvm parametes
I am trying build docker image for my spring boot docker using the command我正在尝试使用命令为我的 spring 启动 docker 构建 docker 映像
mvn spring-boot:build-image
And below is my docker-compose.yml下面是我的 docker-compose.yml
version: '3.3'
services:
spring-boot-container:
ports:
- '7000:7000'
environment:
- SPRING_PROFILES_ACTIVE=${environment}
- JASYPT_ENCRYPTOR_PASSWORD=${JASYPT_ENCRYPTOR_PASSWORD}
- cloud_config_uri=${cloud_config_uri}
- "JAVA_OPTS=-Dspring.cloud.config.uri=http://localhost:8888"
image: 'artifactory.cloud.health.com/docker-all/spring_boot_app:latest'
restart: always
container_name: spring_boot_app
But my spring boot app is not coming up with proper profiles and not picking java _opts.但是我的 spring 启动应用程序没有提供正确的配置文件,也没有选择 java _opts。
Basically in old approach i create dockerfile, then i give ENTRYPOINT
where i pass -Dspring.active.profiles
.基本上在旧方法中,我创建 dockerfile,然后在我通过
-Dspring.active.profiles
ENTRYPOINT
But since we using mvn spring-boot:build-image
i dont know how we pass those entrypoint variables.但是由于我们使用
mvn spring-boot:build-image
我不知道我们如何传递这些入口点变量。
Ok, finally resolved, its syntax issue.好的,终于解决了,它的语法问题。 The below way of writing environment works!
以下编写环境的方式有效!
environment:
- JAVA_OPTS=
-Dspring.profiles.active=${environment}
-Dspring.cloud.config.enabled=true
-Dspring.cloud.config.uri=${cloud_config_uri}
-Djasypt.encryptor.password=${JASYPT_ENCRYPTOR_PASSWORD}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.