Source: Dev.to | Jan 10, 2026 (UTC)
I once asked a major stakeholder to install Postgres on his laptop just to see my progress.
It was September 2024. I was earlier in my career, and the shame of that moment still fuels my obsession with Docker and DX today.
The project was in its early stages. When the stakeholder asked to try it himself, I gave him a to-do list:
-
Install Node.js and PNPM.
-
Set up a local Postgres instance.
-
Switch to a Linux environment.
-
Manually configure credentials and run migrations.
I didn’t share a project, I shared a liability. Today, I don’t ship code; I ship environments.
That experience was my wake-up call. I realized that as a developer, my job isn’t just to write code, but delivering value. If a stakeholder or a new teammate can’t run the project in minutes, I’ve failed.
I’ll help you save time and be more effective with one of my favorite development tools ever created: Docker.
Why using Docker? Is not that a DevOps thing?
Yes. Docker is used for DevOps. But almost no one tells you it’s used for professional development environments. Would you prefer to install Docker Desktop and run a few commands to start building or:
- Manually set up Postgres in your machine
- Set up WSL
- Ensure each service is running
- Set up each service individually
- Ensure the versions match
- Etc
This process took my company’s onboarding time from 5 days to a couple of hours.
Docker lets you package your app with everything it needs to run; from code to runtime, and libraries into a single unit called Container; which can run in any OS and machine.
It’s like a bassline. You don’t notice it’s important until it’s gone.
Docker vs Virtual Machines (VMs)
VMs are heavy, they require a full copy of the operating system and consume significant RAM and CPU.
On the other hand, Containers share your machine’s OS kernel and they only install the libraries and dependencies they need.
-
Dockerfile: This is your blueprint. It allows you to specify Docker how you want to build the environment (OS, the Node.js version, and your dependencies)
-
Image: The snapshot. It’s what you get when you build the blueprint given by the dockerfile. It’s a read-only template that contains your application and its environment.
-
Container: This is the image in action. You can start, stop and delete environments without affecting your actual computer.
Solving the “Postgres Headache” with Docker Compose
Remember the list I gave that stakeholder? “Install Postgres, run migrations, set credentials…”
With Docker Compose, we turn that entire manual process into a single command: docker compose up.
Think of each service (application, database, message queue) as an instrument. You’re combining them to create a band, but in YAML.
It’s important to mention this tool is used for development environments and small MVPs in production. You’ll need load balancers and eventually K8s for scaling a complex system.
Suppose we want to dockerize a Next.js app and run a database with it, we’re going to create 3 files in the root folder of the project.
- docker-compose.yaml
- .dockerignore
- dockerfile
This is how Docker will build the image to run our Next.js application.
FROM node:20-alpine RUN npm install -g pnpm WORKDIR /app COPY package.json pnpm-lock.yaml* ./ RUN pnpm install COPY . . EXPOSE 3000 CMD ["pnpm", "dev"]
Enter fullscreen mode
Exit fullscreen mode



Залишити відповідь