Read more about using the official Node.js docker image.
Quickly execute a node script in a fresh docker container using the command below.
The current directory where the command is run will be mounted into the container as a volume.
docker run -it --rm --name my-running-script \
-v "$PWD":/usr/src/app -w /usr/src/app \
node:14 \
node your-daemon-or-script.js
docker run -it --rm --name my-running-script \
-v "$PWD":/usr/src/app -w /usr/src/app \
node:14 \
node -e "console.log('hello world')"