运维开发网
广告位招商联系QQ:123077622
 
广告位招商联系QQ:123077622

go程序在alpine镜像里无法正常运行

运维开发网 https://www.qedev.com 2021-01-06 12:39 出处:51CTO 作者:seecsea
[[email protected]:~]#kubectllogs-fclient-go-in-cluster-demostandard_init_linux.go:211:execuserprocesscaused"nosuchfileordirectory".非常简单的Dockerfile[[email protected]:/data/Dockerfile/k8stest]#vimDoc

[[email protected]:~]# kubectl logs -f client-go-in-cluster-demo

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

.

非常简单的Dockerfile

[[email protected]:/data/Dockerfile/k8stest]# vim Dockerfile

FROM alpine:3.12.3

COPY ./app /app

CMD ["/app"]

.

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

https://stackoverflow.com/a/62123648

.

CGO has to be disabled for alpine

export CGO_ENABLED=0

Then go build

.

All OK啦!!!!

扫码领视频副本.gif

0

精彩评论

暂无评论...
验证码 换一张
取 消