Docker Basics — Guides | Better Vibe Coding

Docker Basics

What Docker is (in plain English), why vibe coders need it, how to install it, and the commands you'll actually use.

⏱ ~20 min
Last updated February 2026

Before you start

Your IDE should be installed and working (IDE Setup guide). You'll need the terminal inside your IDE for this guide.

What is Docker?

Docker is a tool that packages your app and everything it needs to run into a neat, self-contained box called a container.

Here's why that matters. Your app doesn't run in a vacuum. It needs specific versions of programming languages, libraries, databases, and other tools. On your computer, those things might be set up one way. On someone else's computer, they're set up differently. This is where the classic developer headache comes from: "it works on my machine."

Docker solves this. A container includes your app and everything it needs — the right version of Python or Node.js, the right libraries, the right database. It runs the same way everywhere. Your laptop, your friend's laptop, a server on the internet. Identical.

The moving truck analogy

Think of it like moving apartments. You could carry your furniture piece by piece, set it up in the new place, and hope you remembered how everything was arranged. Or you could pack your entire apartment into a shipping container — furniture, decorations, everything exactly where it belongs — and drop the whole container into the new place. That's Docker. Your app is the apartment. The container is the shipping container. Everything inside stays exactly the same no matter where the container goes.

Why do vibe coders need Docker?

You might be thinking: "I'm just building a simple app. Do I really need this?"

For your very first project, maybe not. But the moment your app needs a database, or uses a specific version of Node.js, or has more than a few dependencies — Docker saves you from a world of pain. Here's what it prevents:

"It was working yesterday." Without Docker, updating something on your computer (even something unrelated) can break your app. With Docker, your app runs inside its container, isolated from everything else.

"I can't install the right version." Different projects sometimes need different versions of the same tool. Docker lets each project have exactly what it needs without conflicts.

"How do I set this up on a server?" When you're ready to put your app on the internet, Docker makes deployment dramatically simpler. The same container that runs on your laptop runs on the server.

You don't need to become a Docker expert. You need to know enough to follow along when AI generates Docker files for your projects — and to troubleshoot when something goes wrong. That's what this guide covers.

Install Docker

Mac

1

Download Docker Desktop

Go to docker.com/products/docker-desktop and download the Mac version. There are two options: Apple Silicon (M1/M2/M3/M4) and Intel. If you bought your Mac in 2021 or later, it's almost certainly Apple Silicon. Not sure? Click the Apple menu → About This Mac and check the chip.

2

Install it

Open the .dmg file and drag Docker to your Applications folder. Launch it. It will ask for your password — this is normal, Docker needs system permissions to run containers.

3

Verify it's running

You should see a small whale icon in your menu bar (top of the screen). Open your terminal in Cursor and type:

Terminal
docker --version

You should see something like Docker version 27.x.x. The exact number doesn't matter — as long as it shows a version, you're good.

Windows

1

Enable WSL 2

Docker on Windows runs through WSL 2 (Windows Subsystem for Linux). Open PowerShell as Administrator and run:

PowerShell (Admin)
wsl --install

Restart your computer when prompted. This sets up a lightweight Linux layer that Docker uses behind the scenes.

2

Download and install Docker Desktop

Go to docker.com/products/docker-desktop and download the Windows version. Run the installer. Make sure "Use WSL 2 instead of Hyper-V" is checked during setup.

3

Verify it's running

After installation, Docker Desktop should launch automatically. Open your terminal in Cursor and type:

Terminal
docker --version

Linux

Open your terminal and run:

Terminal
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
sudo usermod -aG docker $USER

Log out and log back in for the group change to take effect. Then verify:

Terminal
docker --version
Docker Desktop vs. Docker Engine: On Mac and Windows, you install Docker Desktop (a full app with a GUI). On Linux, you can use either Docker Desktop or just the Docker Engine (command-line only). For this guide, either works.

The commands you'll actually use

Docker has a lot of commands. You need about five of them. Here they are.

docker compose up

This is the big one. It reads a file called docker-compose.yml (which AI will typically generate for your project) and starts all the services your app needs — the app itself, a database, whatever's defined in that file.

Terminal
docker compose up

Add -d to run it in the background (so your terminal isn't tied up):

Terminal
docker compose up -d

docker compose down

Stops everything that docker compose up started.

Terminal
docker compose down

docker ps

Shows you what's currently running. Useful when you want to check if your containers are actually up.

Terminal
docker ps

docker compose logs

Shows the output from your containers. If something's not working, this is where you look for error messages.

Terminal
docker compose logs

Add -f to follow the logs in real time (like a live feed). Press Ctrl+C to stop watching.

docker compose build

Rebuilds your containers. Use this when you've changed your Dockerfile or docker-compose.yml and need the changes to take effect.

Terminal
docker compose build

Common gotchas

"Docker daemon is not running." Docker Desktop needs to be open. Check your menu bar (Mac) or system tray (Windows) for the whale icon. If it's not there, launch Docker Desktop.

"Permission denied." On Linux, make sure you added your user to the docker group (the sudo usermod command from the install step). On Mac/Windows, this usually means Docker Desktop isn't running.

"Port already in use." Another app (or another container) is using the same port. Either stop the other thing or change the port in your docker-compose.yml. AI can help you with this — just tell it which port is conflicting.

It's slow the first time. The first time you run docker compose up, Docker downloads all the base images your app needs. This can take a few minutes depending on your internet speed. After the first time, it's cached and much faster.

"No space left on device." Docker images accumulate over time. Clean up old stuff with:

Terminal
docker system prune

It will ask for confirmation. Type y and hit Enter. This removes stopped containers, unused networks, and dangling images.

When in doubt, restart. If Docker is acting weird, try: (1) docker compose down, (2) quit Docker Desktop, (3) reopen Docker Desktop, (4) docker compose up. This fixes most mysterious issues.

Docker is installed. 🐳

You've got Docker running and you know the five commands that matter. Next up: understanding localhost — how to run your app on your own computer and see it in the browser. Localhost →

Wait. Before you go.

Be first to know when we launch — plus get a free chapter right now.

No spam. Ever.