evilmisterspock
evilmisterspock

Reputation: 79

Can't get Docker node application to use up to date version of node/npm

Previous version of the application was using an older version of node and npm:

node v6.9.2 npm v3.10.9

Dockerfile reads as follows:

from netsblox/base

ADD . /netsblox
WORKDIR /netsblox
RUN npm install -g

RUN mkdir -p src/client/dist

EXPOSE 8080

CMD ["npm", "start"]

Dockerfile.base reads as follows:

from node:8.11.2

ENV ENV production
ENV DEBUG netsblox*
ENV NETSBLOX_BLOB_DIR /blob-data

RUN apt-get update && apt-get install build-essential libgd-dev libcairo2-dev libcairo2-dev libpango1.0-dev libgd2-dev -y

RUN echo compile and install gnuplot

RUN mkdir /tmp/gnuInstall -p && cd /tmp/gnuInstall && \
wget https://downloads.sourceforge.net/project/gnuplot/gnuplot/5.2.0/gnuplot-5.2.0.tar.gz && tar -xzvf gnuplot-5.2.0.tar.gz && \
cd gnuplot-5.2.0 && ./configure && make && make install && \
cd ../.. && rm -rf gnuInstall

RUN echo finished installing gnuplot

WORKDIR /netsblox

Should be however when I run

docker build .

it still installs node v6.9.2 npm v3.10, logging below:

npm info using [email protected]

npm info using [email protected]

Should I be editing the node/npm versions elsewhere as well?

Upvotes: 0

Views: 690

Answers (1)

Jonathan Muller
Jonathan Muller

Reputation: 7516

netsblox/base:latest uses nodejs 6.9.2 (docker run netsblox/base:latest node --version)

docker build .: will read the Dockerfile file and build it. The FROM instruction in this Dockerfile targets netsblox/base:latest. It makes sense that the node version used is then 6.9.2

To solve it, rebuild the netsblox/base:latest image using the Dockerfile.base file:

docker build -t netsblox/base:latest - < Dockerfile.base

And then you can rebuild your image using docker build ., it should use the updated version of netsblox/base:latest

Upvotes: 1

Related Questions