Learn Docker: Stop asking your stakeholders to install Node.js

Published: (January 10, 2026 at 08:36 AM EST)
3 min read
Source: Dev.to

Source: Dev.to

I once asked a major stakeholder to install Postgres on his laptop just to see my progress. It was September 2024, early in my career, and the shame of that moment still fuels my obsession with Docker and developer experience today.

When the stakeholder wanted to try the project himself, I gave him a to‑do list:

  1. Install Node.js and PNPM.
  2. Set up a local Postgres instance.
  3. Switch to a Linux environment.
  4. Manually configure credentials and run migrations.

I didn’t share a project—I shared a liability. That experience was my wake‑up call: a developer’s job isn’t just to write code, but to deliver value fast. If a stakeholder or a new teammate can’t run the project in minutes, I’ve failed.

Why Docker for Development?

Docker is often marketed as a DevOps tool, but it shines just as much for professional development environments. Instead of:

  • Installing Postgres manually
  • Setting up WSL
  • Ensuring each service is running and versions match

you can install Docker Desktop once and run a single command to spin up the entire stack. In my company this reduced onboarding time from 5 days to a couple of hours.

Containers share the host OS kernel, so they’re lightweight compared to full VMs. They package only the libraries and dependencies you need, making them fast to start and easy to reproduce on any machine.

Core Docker Concepts

ConceptDescription
DockerfileBlueprint that defines how to build an image (base OS, Node.js version, dependencies, etc.).
ImageRead‑only snapshot produced from a Dockerfile. It contains your application and its environment.
ContainerA running instance of an image. You can start, stop, and delete containers without affecting your host system.

Solving the “Postgres Headache” with Docker Compose

Project structure

/project-root
│   docker-compose.yaml
│   Dockerfile
│   .dockerignore
│   ... (source code)

Dockerfile (builds the Next.js app)

# Dockerfile
FROM node:20-alpine

# Install PNPM globally
RUN npm install -g pnpm

# Set working directory
WORKDIR /app

# Install dependencies
COPY package.json pnpm-lock.yaml* ./
RUN pnpm install

# Copy source code
COPY . .

# Expose the development port
EXPOSE 3000

# Start the dev server
CMD ["pnpm", "dev"]

.dockerignore (prevents unwanted files from entering the image)

node_modules
.pnpm-debug.log

.next
out
build

.env
.env.local
.env*.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

.git
.gitignore

.DS_Store
Thumbs.db

docker-compose.yaml (orchestrates services)

# docker-compose.yaml
services:
  db:
    image: postgres:15-alpine
    container_name: nextjs-db
    restart: always
    environment:
      POSTGRES_USER: admin
      POSTGRES_PASSWORD: supersecretpassword
      POSTGRES_DB: db
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data

  app:
    build: .
    container_name: nextjs-app
    ports:
      - "3000:3000"
    environment:
      DATABASE_URL: postgresql://admin:supersecretpassword@db:5432/db
    volumes:
      - .:/app
      - /app/node_modules
    depends_on:
      - db
    command: pnpm dev

volumes:
  postgres_data:

Key points

  • depends_on ensures the app starts only after the database container is up.
  • For production you’d add a healthcheck to verify the DB is truly ready before the app connects.
  • Using a named volume (postgres_data) persists database data across container restarts.

Running docker compose up builds the Next.js image, pulls the Postgres image, creates a network, and starts both services—turning a one‑hour manual setup into a 10‑second command.

Conclusion

Docker transformed my workflow from “ask stakeholders to install everything” to “ship an environment that runs everywhere”. By containerizing the development stack, I reclaimed time, improved my team’s developer experience, and ensured no one ever has to install a database on their laptop again.

If you want to scale your project—or your career—start containerizing today. Your future self and your team will thank you.

Back to Blog

Related posts

Read more »

Hello, Newbie Here.

Hi! I'm falling back into the realm of S.T.E.M. I enjoy learning about energy systems, science, technology, engineering, and math as well. One of the projects I...