代码:https://gitee.com/renting/jar-docker.git
开始用的是FROM java:8,总是报错说server.port转换string转long之类的。
可是我的jar是可以的,用java -jar完全可以启动并访问。所以问题一定是基础镜像。docker search java8发现williamyeh/java8:latest用的最多换成此就ok了。
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to bind properties under 'server.port' to java.lang.Integer:
Property: -server.port
Value: 8080----
Origin: "--server.port" from property source "commandLineArgs"
Reason: failed to convert java.lang.String to java.lang.Integer
Action:
Update your application's configuration
FROM williamyeh/java8:latest
COPY *.jar /app.jar
EXPOSE 8080
#写死暴露8080
#ENTRYPOINT ["sh","-c","java -Dserver.port=8080 -jar /app.jar "]
ENTRYPOINT ["sh","-c","java -jar /app.jar "]
#ENV JAVA_OPTS_MEN -server -Xms1024M -Xmx1024M -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xloggc:../gc.log
#ENTRYPOINT exec java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap $JAVA_OPTS $SKYWALKING_OPTS $JAVA_OPTS_MEN -jar /app.jar