我的Dockerfile如下:
FROM java
WORKDIR /app
ADD /app/tailf-web-1.2.1-SNAPSHOT.jar /app/
ADD /app/classes/application.yaml /app/log/
# ENTRYPOINT ["java","-version"]
# ENTRYPOINT ["ls","/app"]
# ENTRYPOINT ["echo ==============================="]
# ENTRYPOINT ["ls","/app/log"]
CMD ["java", "‐jar", "/app/tailf-web-1.2.1-SNAPSHOT.jar"]
构建的镜像
现象
使用run命令会报错
[root@registry ~]# docker run -p 8087:8087 -it 192.168.126.99:5000/tailf-web:1.2.1-SNAPSHOT
Error: Could not find or load main class ‐jar
在run 后面手动覆盖启动命令又是正常的
[root@registry ~]# docker run -p 8087:8087 -it 192.168.126.99:5000/tailf-web:1.2.1-SNAPSHOT java -jar /app/tailf-web-1.2.1-SNAPSHOT.jar
LOGBACK: No context given for c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@1537358694
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.2.RELEASE)
- 不知道这是为什么会出现这个问题,我看了仓库里镜像详情是带有启动命令