Hi I am new to the Docker and node. I want to know what does this line means?
FROM node:12.2.0-alpine
What the relationship between node and alpine?
And what if I want to use the newest version of node, what should I change?
Thank you so much!
Alpine is the base image which is based on Alpine Linux, a very compact Linux distribution. So, node:12.2. 0-alpine is a Alpine Linux image with node 12.2. 0 installed. For the latest Alpine based image you can simply do node:alpine .
Outside of a container, this is simple. You install the Node version that you want (use nvm to easily swap between them) and then specify npm version. Doing this inside a container, while possible, is a little bit trickier. You declare the version of Node you want to use with the “FROM” command.
node:<version>-alpine This image is based on the popular Alpine Linux project, available in the alpine official image.
So to wrap up, generally it's a good idea to opt for node alpine unless you have a complicated setup and the official node image makes things easier for you. Almost all the node containers I have worked with, 90% of them run on alpine image. Save this answer. Show activity on this post.
Alpine is the base image which is based on Alpine Linux, a very compact Linux distribution. So, node:12.2.0-alpine is a Alpine Linux image with node 12.2.0 installed.
For the latest Alpine based image you can simply do node:alpine
. If you want latest but not specifically Alpine you can do node:latest
, that image will be based on stretch which is a Debian distribution.
You can find a full list of all supported tags here: https://hub.docker.com/_/node/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With