天天看点

go程序在alpine镜像里无法正常运行CGO has to be disabled for alpineAll OK啦!!!!

[root@spray2:~]# kubectl logs -f client-go-in-cluster-demo

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

.

非常简单的Dockerfile

[root@omp-harbor:/data/Dockerfile/k8stest]# vim Dockerfile

FROM alpine:3.12.3

COPY ./app /app

CMD ["/app"]

搞了半天,其实是alpine镜像的问题:

https://stackoverflow.com/a/62123648

export CGO_ENABLED=0

Then go build