我尝试在 Cloud Run 上运行 micronaut 框架来测试 clod start 性能。
当我在命令行中部署时,我遇到了这个问题:
Deploying...
Creating Revision... Container failed to start. Failed to start and then listen on the port defined by the PORT environment variable. Logs for this revision might contain more information....failed
Deployment failed
ERROR: (gcloud.beta.run.deploy) Container failed to start. Failed to start and then listen on the port defined by the PORT environment variable. Logs for this revision might contain more information.
但是,我测试了几个 dockerfile 配置,我认为我的最后一个对于将 EnvVar 端口传递给预期的 Micronaut EnvVar 是有好处的:
FROM gradle:jdk11-slim as builder
COPY --chown=gradle:gradle . /home/gradle/src
WORKDIR /home/gradle/src
RUN gradle build
FROM adoptopenjdk/openjdk11-openj9:jdk-11.0.1.13-alpine-slim
COPY --from=builder /home/gradle/src/build/libs/micronaut-jib-cr*.jar micronaut-jib-cr.jar
ENV MICRONAUT_SERVER_PORT=${PORT}
EXPOSE ${PORT}
CMD java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Dcom.sun.management.jmxremote -noverify ${JAVA_OPTS} -jar micronaut-jib-cr.jar
因此,我深入研究了 Cloud Run 日志,发现了导致此问题的另一个原因
D Container Sandbox Limitation: Unsupported syscall setsockopt(0x8,0x1,0xc,0x2ae1273fc05c,0x4,0x32)
D Container Sandbox Limitation: Unsupported syscall setsockopt(0x8,0x6,0x6,0x2ae1273fc03c,0x4,0x3a)
A Error: Could not find or load main class micronaut.jib.cr.Application
A Caused by: java.lang.ClassNotFoundException: micronaut.jib.cr.Application
D Container Sandbox Limitation: Unsupported syscall semctl(0x1,0x0,0x2,0x2ae12753ef50,0x2,0x2ae12753ef50)
D Container Sandbox Limitation: Unsupported syscall semctl(0x1,0x0,0x2,0x2ae12753ef50,0x2,0x2ae12753ef50)
D Container Sandbox Limitation: Unsupported syscall semctl(0x1,0x0,0x2,0x2ae12753f440,0x2,0x2ae12753f440)
D Container Sandbox Limitation: Unsupported syscall semctl(0x1,0x0,0x2,0x2ae12753f440,0x2,0x2ae12753f440)
D Container Sandbox Limitation: Unsupported syscall semctl(0x1,0x0,0x2,0x2ae12753f440,0x2,0x2ae12753f440)
D Container Sandbox Limitation: Unsupported syscall semctl(0x1,0x0,0x2,0x2ae12753f440,0x2,0x2ae12753f440)
这是一个真正错误的端口使用吗?在这种情况下,你能帮我处理我的 dockerfile 吗?
如果不是,这是已知的 Cloud Run 限制吗?
micronaut 有解决这个系统调用限制的变通方法吗?
谢谢你的帮助