entrypoint.sh not executed
g610g
HOBBYOP

10 months ago

In my Dockerfile, I have pointed the CMD command to execute the entrypoint.sh that has already the necessary permissions. In the build log, there is no sign of executing the commands in my entrypoint.sh. The detected builder is a Dockerfile not Nixpacks. Also no sign of error during build time, its just that my entrypoint.sh is not executed during build.

Solved$10 Bounty

Pinned Solution

davepoon
PRO

10 months ago

You have to set the ENTRYPOINT ["./entrypoint.sh"] as well, which is the main command executed when the container is run from the image.

Also, make sure you have the necessary commands in your entrypoint.sh script to run your app.

i.e. Node.js app

#!/bin/sh

echo "Starting Nodejs app..."

node server.js

i.e. Python FastAPI app

#!/bin/sh

echo "Starting FastAPI app..."

# Start FastAPI with uvicorn
exec uvicorn main:app --host 0.0.0.0 --port 8000

3 Replies

davepoon
PRO

10 months ago

Have you included lines like these in the Dockerfile?

RUN chmod +x ./entrypoint.sh
ENTRYPOINT ["./entrypoint.sh"]

It works for me by adding that to one of my projects.


davepoon

Have you included lines like these in the Dockerfile?RUN chmod +x ./entrypoint.sh ENTRYPOINT ["./entrypoint.sh"]It works for me by adding that to one of my projects.

g610g
HOBBYOP

10 months ago

Yes, In my DockerFile I have executed the chmod for execute permission.

# Make entrypoint executable
# RUN chmod +x /build.sh
RUN chmod +x /entrypoint.sh

davepoon
PRO

10 months ago

You have to set the ENTRYPOINT ["./entrypoint.sh"] as well, which is the main command executed when the container is run from the image.

Also, make sure you have the necessary commands in your entrypoint.sh script to run your app.

i.e. Node.js app

#!/bin/sh

echo "Starting Nodejs app..."

node server.js

i.e. Python FastAPI app

#!/bin/sh

echo "Starting FastAPI app..."

# Start FastAPI with uvicorn
exec uvicorn main:app --host 0.0.0.0 --port 8000

Status changed to Solved chandrika 10 months ago


Loading...