我想运行这个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值?这是正确的方法吗?
答案 0 :(得分:0)
我认为你把错误的路径设置为metadata-server.yml
" spring.config.location = /配置/元数据server.yml"
我认为之后:
ADD config / / deploy /
metadata-server.yml的路径应为:
" spring.config.location = /部署/配置/元数据server.yml"
答案 1 :(得分:0)
使用
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"]