简体   繁体   English

无需从源代码构建即可在Alpine上固定nodejs版本

[英]Pin nodejs version on Alpine without building from source

I am trying to install Kibana 6.7.0 on Docker. 我正在尝试在Docker上安装Kibana 6.7.0。 Base inherited FROM behance/docker-nginx:8.5-alpine Kibana throws an error stating it requires node version 10.15.2 because alpine default offers 10.16.0 from the apk repo. FROM behance/docker-nginx:8.5-alpine继承的Base引发错误,指出它要求节点版本10.15.2因为alpine的默认版本从apk存储库中提供10.16.0

I tried pinning down node version like this 我试图固定这样的节点版本

curl -O https://nodejs.org/download/release/v10.15.2/node-v10.15.2-linux-x64.tar.gz
tar xzf node-v10.15.2-linux-x64.tar.gz

and ENV PATH="/node-v10.15.2-linux-x64/bin:${PATH}" ENV PATH="/node-v10.15.2-linux-x64/bin:${PATH}"

When I do node -v I get an error saying node /node-v10.15.2-linux-x64/bin/node not found even though it is present. 当我执行node -v ,出现一条错误, /node-v10.15.2-linux-x64/bin/node即使存在节点/node-v10.15.2-linux-x64/bin/node未找到。

Is it possible to install node 10.15.2 without building from the source? 是否可以在不从源代码构建的情况下安装节点10.15.2

No, you have no chance. 不,你没有机会。

In fact although the latest alpine use node10.16 , see this , but your alpine version is v3.9, which use node10.14 , see this . 实际上,虽然最新的node10.16使用node10.16 ,请参阅 ,但您的阿尔卑斯版本是v3.9,其使用node10.14 ,请参阅 I don't know if you can use node10.14 to make you work, but you do not have chance to use apk add to install node10.15 version as they even not stored in apk central repo. 我不知道您是否可以使用node10.14使其工作,但是您没有机会使用apk add安装node10.15版本,因为它们甚至没有存储在apk中央存储库中。

And, download prebuilt package like https://nodejs.org/download/release/v10.15.2/node-v10.15.2-linux-x64.tar.gz from official site definitely not work for you. 而且,从官方站点下载像https://nodejs.org/download/release/v10.15.2/node-v10.15.2-linux-x64.tar.gz这样的预构建软件包绝对不适合您。 This is because alpine use musl libc while official nodejs binary was built with glibc which is more common libc in linux world. 这是因为高山使用musl libc而正式的nodejs二进制文件是使用glibc构建的,而glibc在Linux世界中更常见。 A similar discussion for you reference is here . 供您参考的类似讨论在这里

As a result, the only solution is to use source to build, you can refer to this to add your things to your dockerfile. 因此,唯一的解决方案是使用源代码进行构建,您可以参考此文件将内容添加到dockerfile中。 Additional, multi-stage builds is preferred in your scenario. 在您的方案中,首选其他多阶段构建

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM