I am running into a problem finding good documentation on how to update and check the version of Node that runs on my Docker container. This is just a regular container for .net 2 application. Thank you in advance.
CodePudding user response:
In your Dockerfile
FROM node:14-alpine as development
CodePudding user response:
To answer your questions directly:
If you don't have the Image's Dockerfile:
- You can probably (!) determine the version of NodeJS in your container by getting a shell into the container and then running
node --versionor perhapsnpm --version. You could trydocker run .... --entrypoint=bash your-container node --version - You can change a running Container and then use
docker committo create a new Container Image from the result.
If you do have the Image's Dockerfile:
- You should be able to review it to determine which version of NodeJS it installs.
- You can update the NodeJS version in the
Dockerfileand rebuild the Image.
It's considered bad practice to update images and containers directly (i.e. not updating the Dockerfile).
Dockerfiles are used to create Images and Images are used to create containers. The preferred approach is to update the Dockerfile to update the Image and to use the updated Image to create update Containers.
The main reason is to ensure reproducibility and to provide some form of audit in being able to infer the change from the changed Dockerfile.
