I am trying to deploy a Java Socket application that will serve incoming requests on some port over TCP. The image is building fine and the container is running as expected locally.
However when deploying to GCR it throws the following error
{
"textPayload": "terminated: Application failed to start: Failed to create init process: failed to load /usr/lib/jvm/java-17-openjdk//bin/java: exec format error",
"insertId": "631891ef0005eae9ece915df",
"resource": {
"type": "cloud_run_revision",
"labels": {
"project_id": "cumulus-0",
"service_name": "cumulus",
"revision_name": "cumulus-00001-hib",
"location": "asia-south1",
"configuration_name": "cumulus"
}
},
"timestamp": "2022-09-07T12:43:27.387764458Z",
"severity": "ERROR",
"labels": {
"instanceId": "00c527f6d4880e8a5a96fbdadc4536870f1e55a884c529efc6f860386bb3766d594380d65a657a35adebed119b05e2007cbef26928db216236f1641e97b306"
},
"logName": "projects/cumulus-0/logs/run.googleapis.com%2Fvarlog%2Fsystem",
"receiveTimestamp": "2022-09-07T12:43:27.390641080Z"
}
Specifically - terminated: Application failed to start: Failed to create init process: failed to load /usr/lib/jvm/java-17-openjdk//bin/java: exec format error
this comes when the platform in unsupported for the jvm to run. But it is inside a docker container. I dont know whats the matter with this.
Here is my Dockerfile
FROM alpine:latest
RUN apk update && \
apk add openjdk17-jre=17.0.4.1_p1-r0
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk
LABEL in.rainycloud.cumulus="hi@shantanubanerjee.com"
COPY build/libs/cumulus*.jar /usr/lib/
CMD ["/usr/lib/jvm/java-17-openjdk/bin/java", "-jar", "/usr/lib/cumulus-v0.1.jar", "in.rainycloud.cumulus.Main"]
EXPOSE 33333/tcp