Product Docs
Open Source
Education
Minimal container image for running NodeJS apps
The image specifies a default non-root node user (UID 65532), and a working directory at /app, owned by that node user, and accessible to all users.
node
/app
It specifies NODE_PORT=3000 by default.
NODE_PORT=3000
The image is available on cgr.dev:
cgr.dev
docker pull cgr.dev/chainguard/node:latest
Navigate to the example/ directory:
example/
cd example/
The Dockerfile is based on Docker’s Build your Node image tutorial, but uses the Chainguard node base image instead.
Build the application on the node base image.
docker build \ --tag node-docker \ --platform=linux/amd64 \ .
Then you can run the image:
docker run \ --rm -it \ -p 8000:8000 \ --platform=linux/amd64 \ node-docker
…and test to see that it works:
curl --request POST \ --url http://localhost:8000/test \ --header 'content-type: application/json' \ --data '{"msg": "testing" }'