skip to Main Content

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


  1. In your Dockerfile

    FROM node:14-alpine as development

    Login or Signup to reply.
  2. To answer your questions directly:

    If you don’t have the Image’s Dockerfile:

    1. You can probably (!) determine the version of NodeJS in your container by getting a shell into the container and then running node --version or perhaps npm --version. You could try docker run .... --entrypoint=bash your-container node --version
    2. You can change a running Container and then use docker commit to create a new Container Image from the result.

    If you do have the Image’s Dockerfile:

    1. You should be able to review it to determine which version of NodeJS it installs.
    2. You can update the NodeJS version in the 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search