Docker

Docker packages your application and all its dependencies into a container — a lightweight, portable unit that runs the same way everywhere. It solves the 'works on my machine' problem by ensuring your app behaves identically in development, testing, and production. For vibe coders, Docker is especially useful for deploying AI agents and complex multi-service setups.

Example

Your app needs Node.js 22, PostgreSQL 16, and Redis. Instead of installing each on every machine, you define a Dockerfile and docker-compose.yml. One command — 'docker compose up' — starts everything, configured exactly right.

Docker containers are like shipping containers for software. Pack your app once, and it runs anywhere — your laptop, a VPS, or a cloud service.

Why Docker?

Without DockerWith Docker
"Works on my machine"Works everywhere
Manual dependency setupDependencies included
Environment differences cause bugsIdentical environments
Hard to reproduce issuesSame setup for everyone

Key Concepts

  • Image — A blueprint for your container (like a recipe)
  • Container — A running instance of an image (like the cooked dish)
  • Dockerfile — Instructions to build an image
  • Docker Compose — Run multiple containers together

When Vibe Coders Need Docker

  • Running AI agents — Deploy persistent agents on a VPS
  • Multi-service apps — App + database + cache in one setup
  • Consistent environments — Same setup for dev and production
  • Deployment — Many hosting platforms run Docker containers

Docker Compose Example

Run your full stack with one command:

services:
  app:
    build: .
    ports:
      - "3000:3000"
  database:
    image: postgres:16
    ports:
      - "5432:5432"

docker compose up starts both your app and database together.

Getting Started

  1. Install Docker Desktop — Works on Mac, Windows, Linux
  2. Ask AI to write your Dockerfile — "Create a Dockerfile for my Next.js app"
  3. Build and rundocker build then docker run
  4. Add Docker Compose — When you need multiple services