Error: Invalid or corrupt jarfile when running my app from a remote docker registry

Viewed 452

I am stumped with this issue because I can run my starting application without issues on docker if I build my image and run it locally it just work as expected but when I upload my image to my registry in digital ocean the app says that the jar file is invalid or corrupt,

here is my service.dockerfile

FROM openjdk:11
WORKDIR /application

COPY build/libs/kotlin-service-hello-world-1.0-SNAPSHOT.jar helloworld.jar

COPY --chown=1001:80 docker/entrypoint.sh entrypoint.sh
RUN chmod +x entrypoint.sh

ENTRYPOINT ["/application/entrypoint.sh"]

here's is my entrypoint:

#!/usr/bin/env bash
set -eo pipefail

echo "Running Service.."
pwd
echo "Contents of this dir"
ls -la
java -jar helloworld.jar

Locally I build my image with the following command

docker build . -f docker/service.dockerfile -t myContainer

and then run the container with

docker run -p 8080:8080  myContainer

locally the result is successful everything works as expected I can have access my starting project API on browser,

now when I deploy my image to digital ocean docker registry I successfully get my image created but when I try to pull the image and run it on my machine I get the following logs,

Running Service..
/application
Contents of this dir
total 16
drwxr-xr-x 1 root root 4096 May 29 20:21 .
drwxr-xr-x 1 root root 4096 May 29 20:29 ..
-rwxr-xr-x 1 1001   80  126 May 29 20:21 entrypoint.sh
drwxr-xr-x 2 root root 4096 May 29 20:21 helloworld.jar
Error: Invalid or corrupt jarfile helloworld.jar

as I can see on the logs the files are correctly copied and I even can see the logs from my entrypoint.sh however I get the unexpected "Error: Invalid or corrupt jarfile helloworld.jar"

I still couldn't figure out why it is happening,

the command used to build my image on pipeline before pushing it to registry is the exact same command as I use locally docker build . -f docker/service.dockerfile -t $IMAGE_NAME,

Do anyone know what am I missing here? and why it works locally and fails remotelly?

Thank you in advance for the answers :)

0 Answers
Related