Public repository for ragedunicorn docker nodejs images
401

A minimal Node.js image on Alpine Linux, shipping Alpine's Node.js LTS package and npm pinned to exact versions.
# Pull latest version
docker pull ragedunicorn/nodejs:latest
# Or pull specific version (see the Tags tab for the available versions)
docker pull ragedunicorn/nodejs:<node-major>-alpine<alpine-version>-<build>
# Run Node.js interactively (REPL)
docker run -it --rm ragedunicorn/nodejs:latest
# Run a Node.js script
docker run -v $(pwd):/app ragedunicorn/nodejs:latest script.js
On Windows, use the PowerShell form - ${PWD} with braces and the colon
inside the quotes (without braces PowerShell parses $PWD: as a
scope-qualified variable, as in $env:PATH, and rejects the argument):
# Run a Node.js script in the current directory
docker run -v "${PWD}:/app" ragedunicorn/nodejs:latest script.js
Examples that mount the current directory have a PowerShell variant below the bash one. Examples without a mount run unchanged in PowerShell.
docker run -v $(pwd):/app ragedunicorn/nodejs:latest script.js
PowerShell:
docker run -v "${PWD}:/app" ragedunicorn/nodejs:latest script.js
docker run -it --rm ragedunicorn/nodejs:latest
docker run --rm ragedunicorn/nodejs:latest -e "console.log('Hello, World!')"
# Install dependencies and run a script
docker run --rm -v $(pwd):/app --entrypoint sh ragedunicorn/nodejs:latest -c "npm install && node script.js"
# Install and run the project test suite
docker run --rm -v $(pwd):/app --entrypoint sh ragedunicorn/nodejs:latest -c "npm install && npm test"
PowerShell (single quotes keep && inside the container's sh):
# Install dependencies and run a script
docker run --rm -v "${PWD}:/app" --entrypoint sh ragedunicorn/nodejs:latest -c 'npm install && node script.js'
# Install and run the project test suite
docker run --rm -v "${PWD}:/app" --entrypoint sh ragedunicorn/nodejs:latest -c 'npm install && npm test'
FROM ragedunicorn/nodejs:latest
# Install additional global packages
USER root
RUN npm install -g typescript
USER node
# Your custom configuration
WORKDIR /app
COPY --chown=node:node . .
RUN npm install
CMD ["app.js"]
This image uses semantic versioning that includes all component versions:
Format: {nodejs_major_version}-alpine{alpine_version}-{build_number}
X is the Node.js major version, A.B.C the Alpine version:
X-alpineA.B.C-1 - Node.js X on Alpine A.B.C, first buildX-alpineA.B.C-2 - Rebuild of same versions (bug fixes, security patches)X-alpineA.B.D-1 - Alpine Linux patch updateX - Most recent build of Node.js Xlatest - Most recent stable releaseThe available versions are listed in the Tags tab.
The pinned Node.js and npm package versions are fixed per release and tracked by automated dependency management. When updates are available, new releases are created with appropriate version tags.
The default working directory is /app. Mount your code here:
docker run -v $(pwd):/app ragedunicorn/nodejs:latest your_script.js
PowerShell:
docker run -v "${PWD}:/app" ragedunicorn/nodejs:latest your_script.js
MIT License - See GitHub repository for details.
Content type
Image
Digest
sha256:425b639d2…
Size
30.7 MB
Last updated
18 days ago
docker pull ragedunicorn/nodejs