sh: ./xxx: not found

Posted yunweigo

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh: ./xxx: not found相关的知识,希望对你有一定的参考价值。

FROM golang:1.16.5 as builder
LABEL maintainer=YunweiGo

WORKDIR /app

COPY . .

RUN go env -w GO111MODULE=on; \\
    go env -w GOPROXY=https://goproxy.cn,direct

RUN go build -o hello .

FROM alpine:latest

WORKDIR /app

COPY --from=builder /app/hello /app

ENTRYPOINT ["./hello"]

构建镜像:

docker build -t hello .
docker run hello
>> sh: ./hello: not found #输出如下错误

重新编译,进入容器进行调试

/app # ./hello
>> sh: ./hello: not found
/app # ldd hello
	/lib64/ld-linux-x86-64.so.2 (0x55a0a1807000)
	libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x55a0a1807000)
	libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x55a0a1807000)
/app # ls /lib64/ld-linux-x86-64.so.2
     /lib64/ld-linux-x86-64.so.2 No such file or directory 

我们将文件创建出来

mkdir /lib64
ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2

重新执行正常运行

./hello

以上是关于sh: ./xxx: not found的主要内容,如果未能解决你的问题,请参考以下文章

linux 嵌入式平台,执行可执行程序提示 -sh: xxx: not found

ubuntu下安装tomcat,shutdown时报错:./catalina.sh:1:eval:/home/xxx/jdk/jre/bin/java:not found

sh:not found

expect spawn not found

为啥VC调试所有变量都显示 CXX0017:error:symbol“XXX”not found

[react] Module not found: Can't resolve 'schedule' in 'C:Usersadcaldvmtn7myapp (代码片段