无法使用 Docker 安装 nvm

Shi*_*nha 2 nvm docker

我正在与 AmazonLinux 库合作使用 Node.js 实现 lambda 函数。为此,我正在关注此链接:https : //aws.amazon.com/blogs/networking-and-content-delivery/resizing-images-with-amazon-cloudfront-lambdaedge-aws-cdn-blog/

当我使用命令运行 DockerFile 时:

FROM amazonlinux

WORKDIR /tmp

#install the dependencies
RUN yum -y install gcc-c++ && yum -y install findutils

RUN touch ~/.bashrc && chmod +x ~/.bashrc

RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.5/install.sh | bash

RUN source ~/.bashrc && nvm install 6.10

WORKDIR /build
Run Code Online (Sandbox Code Playgroud)

安装时在第6步显示错误: 安装节点时出现Docker错误

我有以下配置:

  • Ubuntu 16.04
  • 节点:10.6.0
  • npm:6.1.0
  • nvm:0.30.2

按照@Karol Samborki 的建议在 docker 映像中添加 tar 库后,我收到此错误。

在此处输入图片说明

Jay*_*iya 6

这绝对有效,您忘记添加 tar 和 gzip,因为它需要提取 nvm 包。

FROM amazonlinux

WORKDIR /tmp

#install the dependencies
RUN yum -y install gcc-c++ tar gzip findutils

RUN touch ~/.bashrc && chmod +x ~/.bashrc

RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.5/install.sh | bash

RUN source ~/.bashrc && nvm install 6.10

WORKDIR /build
Run Code Online (Sandbox Code Playgroud)