A hardened image designed for VS Code's Dev Containers extension, for use with node, mise, and pnpm.
2.6K
A production-ready Dockerfile optimized for VS Code's Dev Container extension, providing a complete Node.js development environment with mise for version management.
apt, dpkg, curl, etcPrerequisites: Install VS Code and the Dev Containers extension
Open in Container:
.devcontainer/devcontainer.json (see below)Dev Containers: Reopen in ContainerStart Developing: Your development environment is ready with Node.js 24, npm, pnpm, and TypeScript!
Note
It is advised to remove `node_modules` prior to booting into the container as this can create conflicts with the `pnpm` store. Boot into the container, run `pnpm install` and you should be good to go. So long as the lockfile is current, you shouldn't run into any dependency resolution issues.
# Build the container
docker build -t node-devcontainer .
# Run interactively
docker run -it --rm -v "$(pwd)":/workspace node-devcontainer
# Run with proper user mapping (macOS/Linux)
docker run -it --rm -v "$(pwd)":/workspace --user 1000:1000 node-devcontainer
Create .devcontainer/devcontainer.json in your project:
{
"name": "Node.js Dev Container",
"image": "lvnacy/node-devcontainer:latest",
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.vscode-typescript-next",
"esbenp.prettier-vscode"
]
}
}
}
# Pin Node.js version for your project
mise use node@20
# Install specific versions
mise install node@18
mise install npm@10
# List available versions
mise ls
vscode user convention for seamless IDE integrationCustomize the container build:
USERNAME=vscode: Container username (default: vscode)USER_UID=1000: User ID (default: 1000)USER_GID=1000: Group ID (default: 1000)docker build --build-arg USER_UID=$(id -u) --build-arg USER_GID=$(id -g) -t node-devcontainer .
MIT License - see LICENSE file for details.
This project is not accepting PRs at this time. If you encounter a bug or have a suggestion to improve the image, please open an issue.
This container follows VS Code Dev Container conventions and provides an optimized Node.js development environment suitable for any Node.js project.
Content type
Image
Digest
sha256:d13dfa768…
Size
197.2 MB
Last updated
3 days ago
docker pull lvnacy/node-devcontainer