【发布时间】:2017-09-29 16:58:16
【问题描述】:
我正在尝试在 Docker CentO 上安装 NodeJS: 下面是我的dockerfile:
FROM centos:7.3.1611
ADD https://rpm.nodesource.com/setup_8.x /root/
#RUN curl -sL https://rpm.nodesource.com/setup_8.x
RUN bash /root/setup_8.x ;\
yum -y install nodejs ;\
yum -y install java-1.8.0-openjdk
#removed the rest of code
我使用下面来构建容器:
docker-compose build --no-cache
输出如下:
Building test
Step 1/3 : FROM centos:7.3.1611
---> 67591570dd29
Step 2/3 : ADD https://rpm.nodesource.com/setup_8.x /root/
---> 92d4f540a9e8
Removing intermediate container d4cef3605bdd
Step 3/3 : RUN bash /root/setup_8.x ; yum -y install nodejs ; yum -y install java-1.8.0-openjdk
---> Running in 2c331b5211c7
## Installing the NodeSource Node.js 8.x repo...
## Inspecting system...
+ rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release || rpm -q --whatprovides sl-release
+ uname -m
## Confirming "el7-x86_64" is supported...
+ curl -sLf -o /dev/null 'https://rpm.nodesource.com/pub_8.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'
## Your distribution, identified as "centos-release-7-3.1611.el7.centos.x86_64", is not currently supported, please contact NodeSource at https://github.com/nodesource/distributions/issues if you think this is incorrect or would like your distribution to be considered for support
似乎问题是设置脚本中的 'exec_cmd_nobail "curl -sLf -o /dev/null '${RELEASE_URL}'' 返回非零输出,有什么提示吗?这个问题不像一周前那样出现我试过了,我猜Docker Centos镜像有变化?
=========================
- 已解决!答案在 cmets 中。谢谢!
【问题讨论】:
-
试试
centos:7.2.1511图片? -
尝试了不同的centos7发行版和nodejs 8,7,6
-
适用于我的 Dockerfile。您确定这不是中间容器内的网络问题吗?您应该尝试使用 docker exec 附加它并运行 curl 的东西。
-
不确定,但如果是网络问题,“ADD rpm.nodesource.com/setup_8.x /root/”是否也会失败?
-
改用
RUN curl -SsL https://rpm.nodesource.com/setup_8.x | bash。同时删除现有的centos镜像并再次拉取它们