安装nodejs的Docker(撰写)破坏了npm

时间:2017-06-10 22:25:48

标签: node.js nginx docker npm docker-compose

我需要使用带有nginx和nodejs的容器,所以我使用nginx容器并安装节点:

FROM nginx

ENV DEBIAN_FRONTEND noninteractive

WORKDIR /usr/src/app
VOLUME /usr/src/app


RUN apt-get update && \
  apt-get install -y apt-utils && \
  apt-get install -y --no-install-recommends curl sudo wget nano && \
  curl -sL https://deb.nodesource.com/setup_6.x | bash - && \
  apt-get install -y nodejs git build-essential && \
  whereis npm && \
  npm install grunt grunt-cli bower -g && \

whereis returnme nothing npm:npm install...使构建过程崩溃。所以我的错误在哪里,是否有错误或什么?顺便说一句,我正在使用最新的docker-compose和Docker版本17.03.1-ce,构建c6d412e

更新1:它不是this question的欺骗,我只使用一条RUN线

1 个答案:

答案 0 :(得分:0)

FROM nginx

RUN \
    echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections && \
    apt-get update && \
    apt-get install -y apt-utils && \
    apt-get upgrade -y && \
    apt-get update --fix-missing && \
    apt-get install -y curl sudo wget nano git build-essential

# Install NodeJS
RUN \
    wget https://deb.nodesource.com/setup_6.x && \
    chmod +x setup_6.x && \
    ./setup_6.x && \
    apt-get install -y nodejs && \
    npm install grunt grunt-cli