Microservice entrypoint.sh not found

I have a microservice that use JDBC. After many discussion here Add JDBC driver to image build - #13 by Robert_Neale I make it running. For this I need a docker file:

FROM openjdk:17-jdk-slim
COPY etc/ /etc/service-request-mgmt/
ADD resources/* /data/
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENV JAVA_OPTS="--add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/jdk.internal.misc=ALL-UNNAMED"
ENTRYPOINT ["/entrypoint.sh"]

With this as entry point in same directory as the docker file is:

#!/bin/sh
echo "Starting the Java application with the following JAVA_OPTS: $JAVA_OPTS"
java $JAVA_OPTS -jar /data/@package.name@.jar

For long time everything. But today something went wrong for no reason. When I now upload the image to cumulocity I get this error:
"entrypoint.sh": executable file not found
Currently no error is shown up anymore but the microservice is not running.

I imported the image.tar local into my docker and try to run it and get this error message:
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "entrypoint.sh": executable file not found in $PATH: unknown.

I don’t change anything on this part. I only implement more features into my microservice.

I also try to delete the microservice and create them new but this doesn’t help.

What could be the problem? How to fix it?

Ok, I found the problem. The lineendings of my entrypoint.sh changed from LF to CRLF. Changing is back resolve the problem

2 Likes

Hi,
this is a problem that pops up from time to time and it is annoying.

Is there a way to prevent this (we think it is linked to git-pull and kind of operations) ?
Is there a setting in GIT to prevent this?

Thank you for any information.
Regards
Manfred

Just in case anyone is also going to run into the same issue (I also got greeted with the “entrypoint.sh”: executable file not found error after uploading and subscribing to a microservice).

But the reason was different for me: I built the docker image on my arm64 based Mac using colima docker and the images that got created also were targeting the same platform, which obviously won’t work well on a 64-bit linux Cumulocity tenant. The solution was to add --platform linux/amd64 to my docker build command.

2 Likes