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.
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.
2
Answers
In your Dockerfile
FROM node:14-alpine as development
To answer your questions directly:
If you don’t have the Image’s
Dockerfile
:node --version
or perhapsnpm --version
. You could trydocker run .... --entrypoint=bash your-container node --version
docker commit
to create a new Container Image from the result.If you do have the Image’s
Dockerfile
:Dockerfile
and 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.