简体   繁体   English

Spring 引导 dockerfile 配置位置参数未加载

[英]Spring Boot dockerfile configuration location argument not loading

Im Developing a simple docker file for a spring boot war file.我正在为 spring 引导战争文件开发一个简单的 docker 文件。

FROM openjdk:8-jdk-alpine

ARG CONFIG_LOC=/app_config
RUN mkdir $CONFIG_LOC

COPY app_config/* $CONFIG_LOC/ 

ARG JAR_FILE=target/*.war
COPY ${JAR_FILE} app.war

ENTRYPOINT ["java","-Dspring.config.location=/app_config","-Dspring.profiles.active=docker","-jar","/app.war"]

Some how the argument config location is not are not loading when running the spring application.运行 spring 应用程序时,一些参数配置位置未加载。 So the spring application is not running.所以 spring 应用程序没有运行。

Is there a reason to use these as arguments?是否有理由将这些用作 arguments? Usually using something like ARG CONFIG_LOC means you're passing a value in your build command using --build-arg .通常使用ARG CONFIG_LOC之类的东西意味着您正在使用--build-arg在构建命令中传递一个值。 Seems like in this build you should just use hard coded values.似乎在这个版本中你应该只使用硬编码值。 When running the application, any argument should be passed as an environment variable using the -e flag.运行应用程序时,应使用-e标志将任何参数作为环境变量传递。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM