当我在Windows 10上运行docker映像时,出现此错误:
standard_init_linux.go:190: exec user process caused "no such file or directory"
我的Docker文件是:
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"]
并且脚本以#!/ 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
尝试了方法1: 尝试将#!/ bin / sh更改为#!/ bin / bash,但遇到相同的错误。
尝试过的方法2:在docker文件中添加了dos2unix
RUN apt-get install -y dos2unix
RUN dos2unix /run.sh