standard_init_linux.go:190: exec user process caused "no such file or directory" - Docker

gamechanger17 picture gamechanger17 · Jul 25, 2018 · Viewed 86.5k times · Source

When I am running my docker image on windows 10. I am getting this error:

standard_init_linux.go:190: exec user process caused "no such file or directory"

my docker file is:

FROM openjdk:8

EXPOSE 8080

VOLUME /tmp

ADD appagent.tar.gz /opt/app-agent
ADD services.jar app.jar
ADD run.sh /run.sh

# Install compiler and perl stuff
RUN apt-get update
RUN apt-get install -y build-essential
RUN apt-get install -y gcc-multilib
RUN apt-get install -y perl

# Install Percona Toolkit
RUN apt-get install --yes percona-toolkit
RUN ["chmod", "+x", "/run.sh"]
ENTRYPOINT ["/run.sh"]

and the script is start with #!/bin/sh

#!/bin/sh
set -e

JAVA_OPTS="-Dfile.encoding=UTF-8 -Djava.security.egd=file:/dev/urandom"

if [ "${APPD_APP_NAME}" != "" ]; then
JAVA_AGENT="-javaagent:/opt/app-agent/javaagent.jar
fi

exec java ${JVM_OPTS} ${JAVA_OPTS} ${JAVA_AGENT} -jar /app.jar

Tried method1: Tried changing #!/bin/sh to #!/bin/bash but getting same error.

Tried method2: added dos2unix in docker file

RUN apt-get install -y dos2unix
RUN dos2unix /run.sh

Answer

Vikas Rathore picture Vikas Rathore · Oct 5, 2018

Use notepad++, go to edit -> EOL conversion -> change from CRLF to LF.