0

I have built a simple REST API using springboot3 and graalVM runtime. I am trying to dockerize the same app and run locally. But upon running the container I get error
exec /app: exec format error. I am using mac M1 and trying to run docker container locally.

This is my Dockerfile

#FROM container-registry.oracle.com/os/oraclelinux:8-slim
#FROM scratch
FROM gcr.io/distroless/base

EXPOSE 8080
COPY build/native/nativeCompile/nativeimage app
ENTRYPOINT ["/app"]

Docker image inspection

 "Architecture": "arm64",
        "Os": "linux",

I could run my native executable but expecting to be run as a docker container too. I am using gradle build too hence finding it difficult how to build native image inside a container?

Neha Rane
  • 1
  • 1
  • https://github.com/nehurane/springboot3-nativeimage – Neha Rane Nov 17 '22 at 13:28
  • Is your native image a Mac or Linux binary? If it's Mac, it won't run inside a Linux container – peterz Nov 18 '22 at 12:17
  • native image is Mac bases. I am not getting where exactly I should mentioning that it should use mac binary. Means what base image I should use for docker container? – Neha Rane Nov 18 '22 at 14:02
  • Added a multi stage build Dockerfile and now I am stuck on >> failed to compute cache key: f ailed to walk /var/lib/docker/tmp/buildkitmount2766813902/build/native/nativeCompile: lstat /var/lib/docker/tmp/buildkit-mount2766813902/build/native/nativeCompile: no such file or directory – Neha Rane Nov 18 '22 at 22:07

0 Answers0