Why nvm often beats Docker for Node.js development


When working with Node.js projects, you might be tempted to use Docker to containerize your environment right away. Docker is powerful, but sometimes it’s like using a cannon to kill a fly.

In many cases, nvm (Node Version Manager) is a much simpler, faster, and more convenient solution - especially during day-to-day development.


What is nvm?

nvm stands for Node Version Manager. It’s a command-line tool that allows you to install, manage, and switch between multiple Node.js versions on your local machine effortlessly.

This flexibility is crucial because different projects often require different Node versions. Instead of globally installing one Node version and risking compatibility issues, nvm lets you isolate environments per project or per terminal session.

You can easily switch Node versions with a simple command like:

nvm use 16

or install new versions on the fly:

nvm install 18

It works cross-platform (mostly on Unix-like systems; for Windows there’s nvm-windows), and integrates well with your existing workflow and editors.

Why nvm is often enough

For most developers working on Node.js apps locally, nvm covers 90% of the needs without any extra overhead.

Because it runs directly on your machine, nvm:

  • Starts instantly - no waiting for containers to boot
  • Uses your local filesystem and network stack directly, making debugging and hot-reloading seamless
  • Keeps things simple - no need to write and maintain Dockerfiles, volumes, or network configs
  • Plays nicely with native tooling like VSCode debuggers, linters, and terminal commands
  • Avoids the resource overhead of running full Linux containers with isolated OS instances

This means you can focus on coding rather than infrastructure - which is the whole point during development.


When Docker is overkill

Docker is a fantastic tool, especially when you need to:

  • Replicate production environments exactly
  • Run multiple services together (databases, caches, message queues) in isolated containers
  • Enable easy sharing of consistent environments across teams and CI systems
  • Package applications for deployment on various platforms

However, sometimes you just want something even simpler - a tool that works instantly with a single terminal command, no container setup, no extra layers.

For simple cases like switching Node versions or running a local dev server for one app, spinning up a Docker container can:

  • Add unnecessary complexity and boilerplate
  • Slow down your development workflow due to container startup time
  • Make debugging more complicated because you’re “inside” a container environment
  • Require extra configuration for volumes, ports, and environment variables

In these situations, nvm shines as a lightweight, fast, and zero-config solution that gets you coding immediately.


My personal recommendation is:

  • Use nvm locally during development to manage Node versions effortlessly
  • Reserve Docker for complex multi-service projects, production builds, or CI pipelines where environment parity matters
  • Combine both when necessary - for example, develop locally with nvm and test production-like scenarios in Docker containers before deployment

This way you get the best of both worlds: speed and simplicity in dev, and consistency and isolation in production.


Summary

Before jumping to Docker for every Node.js project, pause and ask yourself: Do I really need a container right now?

Most of the time, nvm provides everything you need to manage Node versions and develop efficiently - quickly, simply, and without overhead.

Sometimes, a fly just needs a gentle swat - no cannon required.

Bartłomiej Nowak

Bartłomiej Nowak

Programmer

Programmer focused on performance, simplicity, and good architecture. I enjoy working with modern JavaScript, TypeScript, and backend logic — building tools that scale and make sense.

Recent Posts