Home > OS >  How to update nodejs on a docker container ? Linux Debian
How to update nodejs on a docker container ? Linux Debian

Time:09-03

I would like to update nodejs but how to update nodejs on a docker container in a debian 10 ?

My dockerfile : https://i.stack.imgur.com/DK4rD.jpg

I saw I need to update the dockerfile with the version but I got an error.

https://i.stack.imgur.com/rACl0.jpg

CodePudding user response:

You cannot just add another FROM line (except multi-stage builds). Each image can only have one base image that is defined using FROM.

There are different possible approaches to combine components from two images:

  1. You update the base image (if you are the author of the base image, i.e. moiamond/docker-ffmpeg-base-debian) to your needs
  2. You run the necessary commands in your Dockerfile to install/update the nodejs version you want to have (might be tricky if the image is very old and there is no up-to-date node version available as package).
  3. You use a different base image, e.g. an image that contains the node version you want to use and install ffmpeg and other components that are contained in moiamond/docker-ffmpeg-base-debian via your Dockerfile.
  • Related