Spring boot Java Docker base image issues

bharath6365TRIAL

a year ago

[FATAL tini (7)] exec java failed: Exec format error

Running into this issue while deploying, my base image was built on a MAC M1

Use the official OpenJDK image as the base image

FROM openjdk:17-oracle

Set the working directory in the Docker image

WORKDIR /app

Copy the built JAR file into the Docker image

ARG JARFILE=pricing-server/target/*.jar COPY ${JARFILE} app.jar

EXPOSE 8080

Command to run the application

ENTRYPOINT ["java","-jar","app.jar"]

View Deploy details

ⓘ Deployment information is only viewable by Project members and Railway admins.

1 Replies

a year ago

Your Dockerfile copies the already built JAR file into the image, this would be incorrect, the Dockerfile needs to copy the project into the image (excluding any already built files) and would need to include instructions for building the JAR file from scratch from the project files.


Spring boot Java Docker base image issues - Railway Help Station