Node.js dev container on Ubuntu 24.04 with pnpm
363
A lightweight Node.js container based on Ubuntu 24.04, designed for general Node.js development.
pnpm as a fast, disk space-efficient package managerCurrently, only the :latest tag is available for this image:
wayoyo/node:latestYou can use this tag directly, or pull it as wayoyo/node:ubuntu-24.04-latest if you prefer a more descriptive name.
If you want to create and use additional tags (for example, for different versions or variants), you can do so by building and pushing the image with a new tag:
# Build with a new tag
docker build -t wayoyo/node:v1 .
# Tag an existing image
docker tag wayoyo/node:latest wayoyo/node:ubuntu-24.04-latest
# Push the new tag to Docker Hub
docker push wayoyo/node:v1
docker push wayoyo/node:ubuntu-24.04-latest
docker pull wayoyo/node:latest
Run the container with an interactive bash shell:
docker run -it wayoyo/node:latest
docker run -it wayoyo/node:latest node
For development, mount your local project directory to the container's /app directory:
docker run -it -v $(pwd):/app wayoyo/node:latest
docker run -v $(pwd):/app wayoyo/node:latest node your_script.js
If your Node.js application serves on port 3000 (or any other port), map it to your host:
docker run -it -p 3000:3000 -v $(pwd):/app wayoyo/node:latest
For web applications that serve on port 3000:
# Navigate to your project directory
cd /path/to/your/node/project
# Run with port mapping and volume mount
docker run -it -p 3000:3000 -v $(pwd):/app wayoyo/node:latest
# Inside the container, install dependencies and run your app
npm install
npm start
# Install dependencies with pnpm
docker run -it -v $(pwd):/app wayoyo/node:latest pnpm install
# Run a single Node.js script and exit
docker run --rm -v $(pwd):/app wayoyo/node:latest node script.js
You can pass environment variables to customize the container behavior:
docker run -it -e NODE_ENV=development -v $(pwd):/app wayoyo/node:latest
Create a docker-compose.yml file for easier development:
version: '3.8'
services:
node-dev:
image: wayoyo/node:latest
ports:
- "3000:3000"
volumes:
- .:/app
environment:
- NODE_ENV=development
working_dir: /app
tty: true
stdin_open: true
Then run:
docker-compose up -d
docker-compose exec node-dev bash
If you want to build the image locally:
git clone <repository-url>
cd Dockerfile/docker/node/ubuntu-24.04/latest
docker build -t wayoyo/node:latest .
We would like to express our sincere gratitude to the webdevops team for their incredible work and enthusiasm in the Docker ecosystem. Their code and innovative approaches have been truly inspiring for this project.
This contribution is not intended to diminish or take credit from their outstanding work, but rather to add more tools and perspectives to the community from our own point of view. We believe in building upon great foundations and contributing back to the open-source ecosystem that has given us so much.
Thank you to the webdevops team for paving the way and inspiring developers like us to create better tools for everyone.
Feel free to open issues or submit pull requests to improve this image.
MIT License
Content type
Image
Digest
sha256:22ec2b699…
Size
173.2 MB
Last updated
about 1 year ago
docker pull wayoyo/node