简体   繁体   English

Spring 使用 docker 启动构建 mvn spring-boot:build-image with Z6CE80D8EF01F5E3BAEEZB 参数

[英]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.

相关问题 在Spring Boot 2.3.0运行mvn spring-boot:build-image命令时如何设置JVM arguments生成docker镜像? - How to set JVM arguments when running mvn spring-boot:build-image command in Spring Boot 2.3.0 to generate a docker image? mvn spring-boot:build-image 不会在 docker 中保存图像 - mvn spring-boot:build-image doesn't save image in docker 我未能在 win10 上使用 `mvn spring-boot:build-image` 和远程 docker 守护程序 - I failed to use `mvn spring-boot:build-image` and remote docker daemon on win10 无法使用 mvn spring-boot:build-image 构建战争文件的映像 - Can't build image of war file using mvn spring-boot:build-image spring-boot:在代理后面构建映像 - spring-boot:build-image behind a proxy 在 Gitlab-ci.yaml 管道中使用 spring-boot:build-image 创建 docker 镜像 - Using spring-boot:build-image in Gitlab-ci.yaml Pipeline to create a docker image 为什么“spring-boot:build-image”会运行 Spring Boot 应用程序? - Why does "spring-boot:build-image" run the Spring Boot application? 安装了 Npm 的 Spring Boot 构建映像 - Spring Boot build-image with Npm installed 将私有 buildpack 注册表与 spring-boot:build-image 一起使用的正确方法是什么? - What is the correct way to use a private buildpack registry with spring-boot:build-image? 在 spring-boot:build-image 中将 Liberica Jdk 更改为另一个 - Change Liberica Jdk with another one in spring-boot:build-image
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM