FXAMN FXAMN - 3 months ago 15
Node.js Question

Installing specific version of node.js and npm in ubuntu image with Dockerfile

I would like to know how can update my custom Dockerfile to install Node v6.3.1 and NPM v3.10.6 without breaking what is already in there.

Currently this is my custom file:

FROM ubuntu:16.10

MAINTAINER Fátima Alves

COPY . /my-software
WORKDIR /my-software

RUN apt-get update \
&& \
apt-get install -y \
python-dev \
tesseract-ocr


Thanks!




Update

Currently my dockerfile is like this:

FROM ubuntu:16.10

MAINTAINER Fátima Alves

COPY ./dist /my-software
COPY ./s3-config.json /my-software
COPY ./_* /my-software
COPY ./node_modules /my-software
WORKDIR /dataextractor

RUN apt-get update \
&& \
apt-get install -y \
curl

RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - \
&& apt-get install -y nodejs


And is returning:

The command '/bin/sh -c curl -sL https://deb.nodesource.com/setup_6.x | bash - && apt-get install -y nodejs' returned a non-zero code: 1


Perhaps i'm missing something?

Guy Guy
Answer

You can just follow the usual Ubuntu install instructions, just within the RUN statement in your Dockerfile

RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - \
    && apt-get install -y nodejs

Docs

Comments