Sunday, July 24, 2022

[SOLVED] Docker error on an entrypoint script: "no such file or directory"

Issue

I'm using Docker image ubuntu:trusty and have an entrypoint.sh file contains

#!/bin/bash
. /appenv/bin/activate
exec $@

In Dockerfile contains for entrypoint scripts

ADD scripts/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]

got an error exec user process caused "no such file or directory"


Solution

I am quite convinced that this is a common scenario where this error is caused by using wrong lines endings in entrypoint scripts.

You can use dos2unix command to fix them or do this manually.

For a more detailed answer, you need to provide more contextual info.



Answered By - Grzegorz Piwowarek
Answer Checked By - Senaida (WPSolving Volunteer)