Getting Started
25 minutes
linux
macos
windows

Installing Docker

Learn what Docker is, when you need it, and how to install Docker Desktop on any operating system.

What you'll accomplish

Have Docker installed and running on your computer, or understand when to skip it.

Prerequisites

  • Completed previous Getting Started lessons
  • At least 8GB RAM (16GB recommended)
  • 20GB free disk space

What is Docker?

Docker is a tool that creates isolated environments called "containers" for running software. Each container is like a tiny, self-contained computer inside your computer.

Before shipping containers existed, moving goods was chaos:

  • Different ports had different equipment
  • Fragile items mixed with heavy machinery
  • Loading took forever because everything was different sizes

Shipping containers solved this:

  • Standard size fits any ship, truck, or train
  • Contents are isolated and protected
  • Move anything anywhere with the same equipment

Docker does the same for software:

  • Standard "container" runs anywhere: your laptop, a server, the cloud
  • Everything the app needs is inside the container
  • No more "works on my machine" problems

Do You Need Docker?

Honest answer: Not immediately, especially if you're just starting out.

When Docker IS helpful:

  • Running AI coding tools in isolated environments
  • Working on projects with complex dependencies
  • Matching your development environment to production
  • Using --dangerously-skip-permissions safely

When to skip Docker (for now):

  • You're brand new to coding
  • You just want to try AI-assisted development
  • Your computer has limited RAM (< 8GB)
Note

Our recommendation: Read this lesson to understand what Docker is. Install it if you have a computer that can handle it. But don't let Docker be a blocker - you can do AI-assisted coding without it.

Docker becomes essential when you want to:

  1. Run --dangerously-skip-permissions: This flag auto-approves all AI actions. In Docker, if something goes wrong, you just delete the container. No harm to your actual computer.

  2. Reproducible environments: Your container config is code. Anyone can recreate your exact setup.

  3. Isolation: Projects with conflicting dependencies (Node 16 vs Node 20) can run in separate containers.

  4. CI/CD: The same container that runs locally runs in your deployment pipeline.

We cover advanced Docker usage in the Claude Code Advanced track.

Installing Docker

Basic Docker Concepts

Here are terms you'll encounter when using Docker:

TermWhat it means
ImageA blueprint/recipe for creating containers. Like a frozen snapshot.
ContainerA running instance of an image. The actual isolated environment.
DockerfileA text file with instructions to build an image. Like a recipe.
VolumeA way to save data that persists even when containers are deleted.
Docker HubA website hosting thousands of pre-made images.

Think of baking cookies:

  • Image = The cookie recipe (instructions + ingredients list)
  • Container = An actual batch of cookies you baked

From one recipe (image), you can bake many batches (containers). Each batch is independent - burning one doesn't affect the others.

When you run docker run hello-world, Docker:

  1. Downloads the hello-world image (recipe) if you don't have it
  2. Creates a container (batch) from that image
  3. Runs the container
  4. The container prints its message and exits

Common Docker Commands

You don't need to memorize these - just know they exist:

CommandWhat it does
docker run <image>Create and start a container from an image
docker psList running containers
docker ps -aList all containers (including stopped)
docker imagesList downloaded images
docker stop <id>Stop a running container
docker rm <id>Delete a stopped container
docker pull <image>Download an image without running it

Test Your Installation

Let's run a simple test to make sure Docker works:

bash
# Run a simple web server
docker run -d -p 8080:80 nginx
  • docker run = start a container
  • -d = detached mode (run in background)
  • -p 8080:80 = connect port 8080 on your computer to port 80 in the container
  • nginx = use the nginx web server image

Now open your browser and go to: http://localhost:8080

You should see the "Welcome to nginx!" page.

Clean up:

bash
# Find the container ID
docker ps

# Stop and remove it (replace <id> with actual ID from previous command)
docker stop <id>
docker rm <id>

Or simply:

bash
docker stop $(docker ps -q)
docker rm $(docker ps -aq)

Common Issues

Frequently Asked Questions

Mac/Windows: Docker Desktop needs significant resources. Try:

  1. Close other applications to free memory
  2. Restart Docker Desktop
  3. Restart your computer

Windows specific: Make sure WSL2 is properly installed:

powershell
wsl --status

If there's an issue, run wsl --update.

Docker isn't running.

  • Mac/Windows: Open Docker Desktop and wait for it to start
  • Linux: Run sudo systemctl start docker

Go to Docker Desktop → Settings → Resources and reduce the limits.

Alternatively, stop containers you're not using:

bash
docker stop $(docker ps -q)

You probably forgot to add yourself to the docker group, or didn't log out/back in after doing so.

bash
sudo usermod -aG docker $USER

Then log out and back in.

Docker Desktop is free for:

  • Personal use
  • Small businesses (fewer than 250 employees AND less than $10M annual revenue)
  • Education
  • Open source projects

Large businesses need a paid subscription. Docker Engine (CLI-only, Linux) is always free.

Yes! Docker is powerful but not required for getting started with AI coding tools. You can:

  • Run Claude Code directly on your system
  • Use the built-in permission system instead of --dangerously-skip-permissions
  • Add Docker later when you want more isolation

Don't let Docker complexity stop you from starting.

Verify Your Understanding

You've completed this lesson if you can:

0/4

Next: Learn about IDEs - the applications where you'll actually write and edit code.