I dont use Docker but from i read in the Image Variations section of the node-red docker docs
the version of nodejs depends on the image tag
that you use to spin up the container.
For example if you use
docker run -it -p 1880:1880 -v node_red_data:/data --name mynodered nodered/node-red:latest-minimal
using the latest-minimal
tag comes with nodejs version 16
but you have a list of different image tags like 3.1.3-18
that comes with nodejs 18