![](/img/trans.png)
[英]Issues building a spring boot application from within a Dockerfile on Linux
[英]External config in Spring Boot application within Dockerfile
我想运行此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
运行时,它不是在读取metadata-server.yml值吗? 这是正确的方法吗?
我认为您输入了meta-server.yml错误的路径
“spring.config.location =。/配置/元数据server.yml”
我认为在:
添加配置/ /部署/
metadata-server.yml的路径应为:
“spring.config.location = /部署/配置/元数据server.yml”
采用
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
更新:
或者更好地尝试这个
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.