问题描述
我正在尝试编写一个使用alpine并利用预编译golang的dockerfile。
docker run -it高山:最新
wget https://dl.google。 com / go / go1.12.9.linux-amd64.tar.gz --no-check-certificate
tar -C / usr / local / -xzf go1 * .tar.gz
我正在/ bin / sh /:./go:找不到
cd / usr / local / go / bin /
./go
它可以在我的ubuntu笔记本电脑上正常工作,所以我不确定这有什么区别。我做了一个快速的谷歌,我找不到任何明显的地方,这表明缺少的东西。
Alpine是使用 C库。您不能在这种环境下运行为glibc编译的二进制文件。您需要找到专门为Alpine平台构建的 go
二进制文件(例如,通过运行 apk add go
)。 / p>
I'm trying to write a dockerfile that uses alpine and takes advantage of a precompiled golang.
docker run -it alpine:latest
wget https://dl.google.com/go/go1.12.9.linux-amd64.tar.gz --no-check-certificate
tar -C /usr/local/ -xzf go1*.tar.gz
I'm getting /bin/sh/: ./go: not found
cd /usr/local/go/bin/
./go
It works fine on my ubuntu laptop so I'm unsure what the difference is here. I did a quick google and I could not find anything clear that points to something missing.
Alpine is built using the MUSL C library. You cannot run binaries that have been compiled for glibc in this environment. You would need to find a go
binary built explicitly for the Alpine platform (e.g. by running apk add go
).
这篇关于在高山上预编译的golang的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!