[英]External config in Spring Boot application within Dockerfile
I want to run this Dockerfile application: 我想运行此Dockerfile应用程序:
FROM java:8-jre
ADD config/ /deploy/
COPY ./meta.std.1.0.1.jar /deploy/
CMD chmod +x ./deploy/meta.std.1.0.1.jar
CMD ["java","-jar","/deploy/meta.std.1.0.1.jar","metastore","spring.config.location=./config/metadata-server.yml"]
EXPOSE 3011
While running, it's not reading the metadata-server.yml values? 运行时,它不是在读取metadata-server.yml值吗? Is this the correct way?
这是正确的方法吗?
I think that you put the wrong path of metadata-server.yml 我认为您输入了meta-server.yml错误的路径
"spring.config.location=./config/metadata-server.yml"
“spring.config.location =。/配置/元数据server.yml”
I think that after: 我认为在:
ADD config/ /deploy/
添加配置/ /部署/
the path of metadata-server.yml should be: metadata-server.yml的路径应为:
"spring.config.location=/deploy/config/metadata-server.yml"
“spring.config.location = /部署/配置/元数据server.yml”
Use 采用
FROM java:8-jre
ADD config/ /deploy/
COPY ./meta.std.1.0.1.jar /deploy/
CMD chmod +x ./deploy/meta.std.1.0.1.jar
CMD ["java","-jar","/deploy/meta.std.1.0.1.jar","metastore","--spring.config.location=classpath:file:/deploy/metadata-server.yml"]
EXPOSE 3011
Update: 更新:
Or better try this 或者更好地尝试这个
FROM alpine:edge
VOLUME /tmp
RUN apk --no-cache upgrade && apk --no-cache add openjdk8-jre
ADD config/ /deploy/
COPY ./meta.std.1.0.1.jar /deploy/
ADD /YOUR/CONFIG/metadata-server.yml /deploy/metadata-server.yml
EXPOSE 3011
ENTRYPOINT ["java" ,"-Djava.security.egd=file:/dev/./urandom --spring.config.location=classpath:file:/deploy/metadata-server.yml","-jar","/deploy/meta.std.1.0.1.jar"]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.