【发布时间】:2020-02-10 15:41:26
【问题描述】:
我有以下 Dockerfile
FROM openjdk:8-jdk-alpine
RUN mkdir -p ./webpieces
COPY . ./webpieces/
COPY config/logback.cloudrun.xml ./webpieces/config/logback.xml
ENV PORT=8080
WORKDIR "/webpieces"
ENTRYPOINT ["./bin/authservice", "-http.port=:$PORT", "-hibernate.persistenceunit=production"]
但是,字符串 $PORT 最终出现在我的应用程序中,而不是 8080。我也尝试了命令行,但也无济于事。知道这里发生了什么吗?
我的意思是我使用
运行我的应用程序docker run --env PORT=8080 -p 127.0.0.1:8080:8080 gcr.io/orderly-gcp/authservice
在启动时它说
-http.port following usages:
(optional, default: :8080)Http host&port. syntax: {host}:{port} or just :{port} to bind to all NIC ips on that host
Value Parsed::$PORT foundKey:true foundValue:true
如果我绑定到所有端口,Value Parsed 部分通常会显示:8080。如果我硬编码为 :8080 而不是 :$PORT 或 :${PORT} ,它工作正常。我看不到让变量起作用。
谢谢, 院长
【问题讨论】:
标签: docker dockerfile