使用 jib 设置多个 jvm 参数构建 docker 镜像
quarkus.jib.jvm-additional-arguments=-XX:InitialRAMPercentage=50, -XX:MaxRAMPercentage=90
抛出错误并阻止容器运行。
Error: Could not find or load main class -XX:InitialRAMPercentage=50
Caused by: java.lang.ClassNotFoundException: -XX:InitialRAMPercentage=50
我使用以下属性使用 jib 构建 Quarkus 应用程序:
quarkus.jib.base-jvm-image=registry.access.redhat.com/ubi8/openjdk-17:1.19-1
quarkus.jib.jvm-arguments=-Djava.net.preferIPv4Stack=true
quarkus.jib.jvm-additional-arguments=-XX:InitialRAMPercentage=50, -XX:MaxRAMPercentage=90
我想使用多个 jvm 参数,但这会在我尝试运行容器时导致以下错误:
Error: Could not find or load main class -XX:InitialRAMPercentage=50
Caused by: java.lang.ClassNotFoundException: -XX:InitialRAMPercentage=50
在映像构建过程中,使用两个附加 jvm 参数正确设置容器入口点。
当我手动构建容器时
docker built -t x/y .
不会出现上述错误。
改变:
quarkus.jib.jvm-additional-arguments=-XX:InitialRAMPercentage=50, -XX:MaxRAMPercentage=90
进入
quarkus.jib.jvm-additional-arguments="-XX:InitialRAMPercentage=50 -XX:MaxRAMPercentage=90"
PS:您错过了参数周围的引号。另外我认为,我可能是错的,你应该删除
,
。