Reputation:
FROM node:latest
RUN mkdir -p /app/templates
WORKDIR /app
COPY package.json /app/package.json
COPY *.js /app/
RUN npm install npm@latest -g
CMD ["node","/app/index.js"]
From the above Dockerfile is there any way to update node like when you update Ubuntu or apt-get update?
Or, is npm all you can really control?
Upvotes: 2
Views: 7613
Reputation: 977
As Russley Shaw said, docker pull node:latest
will download the most recent node:latest
image from DockerHub and if the downloaded image is different from your local one, it will overwrite your local node:latest
image with the newer downloaded one. Then, when you do a docker build
, Docker will recognize that node:latest
has changed (assuming that your docker pull node:latest
updated your local image). Then, Docker will invalidate all its caches used in building the container and rebuild it starting from the very first Dockerfile instruction at
FROM node:latest
You can check when the Node team last pushed a new image to DockerHub on their DockerHub repo page I believe.
Upvotes: 2