docker - 无法使用 Docker 安装 nvm

标签 docker nvm

我正在与 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

安装时第 6 步显示错误: Docker error while insatlling node

我有以下配置:

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

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

enter image description here

最佳答案

这绝对有效,您忘记添加 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

关于docker - 无法使用 Docker 安装 nvm,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51204115/

相关文章:

postgresql - 为什么我的 import.sql 文件没有自动运行?

linux - 从 Docker Stack 启动 docker-compose 文件时是否可以获取环境文件

node.js - 如何删除旧版本的nodejs?

node.js - 如何从 .bash_profile 访问我的 nvm Node 版本号以自定义终端提示符?

node.js - 找不到 WSL2 : cannot install Node, 版本上的 NVM

django - Python subprocess.Popen()在Docker容器中不起作用-在本地工作正常

docker - GO - 本地导入不工作

node.js - 为什么 `node` 将 `npm` 的版本固定到每个版本?

docker - Docker-无法从容器内部ping主机子网上的任何内容

linux - 通过 NVM 更改版本时,应该如何更新 Node 检查器等全局包的路径?