Master Code
On The Go

Learn. Practice. Build.

How-To Guide

How to Install Docker

Docker packages apps into containers so they run the same everywhere — your laptop, your server, your team's machines. Here's how to install it in under 15 minutes.

📋 What You'll Need

✅ Docker Desktop is free for personal use, education, and small businesses.

🐳 What Is Docker?

Docker is a tool that lets you package your app and everything it needs (code, runtime, libraries, settings) into a single unit called a container. Containers run the same on every machine, so you eliminate the classic "works on my machine" problem.

You'll use Docker for:

1

Download Docker Desktop

Go to the official website:

👉 docker.com/products/docker-desktop

;

Choose your platform:

  • Windows: Docker Desktop for Windows (x64)
  • Mac: Docker Desktop for Mac (Intel or Apple Silicon)
  • Linux: Docker Engine (see step 2b) — no Desktop needed
2

Run the Installer

Windows:

  • Open the downloaded Docker Desktop Installer.exe
  • Enable "Use WSL 2 instead of Hyper-V" (recommended)
  • Click "Ok" and wait for installation
  • Restart your computer when prompted

Mac:

  • Open the downloaded .dmg file
  • Drag Docker into your Applications folder
  • Open it from Applications — enter your password if asked

Linux (Ubuntu/Debian):

# Install Docker Engine
curl -fsSL https://get.docker.com | sudo sh

# Add your user to the docker group (so you don't need sudo)
sudo usermod -aG docker $USER

# Log out and back in for the group change to take effect
3

Launch Docker

Open Docker Desktop from your Start menu or Applications folder. Wait for the whale icon in your menu bar or system tray to stop animating — when it turns solid, the engine is running.

If asked to sign in or create an account, you can skip that — Docker works fine without an account for local development.

💡 Windows users: if Docker Desktop asks about WSL 2, say yes. It's much faster than the old Hyper-V backend.

4

Verify It Works

Open a terminal (PowerShell, Terminal, or bash) and run:

docker --version

You should see something like Docker version 27.0.3.

Now run the classic hello-world container:

docker run hello-world

You should see a message starting with Hello from Docker!. 🎉

This just downloaded an image, created a container, ran a program, and cleaned up — the entire Docker lifecycle in one command.

🧠 Essential Docker Commands

docker ps                    # list running containers
docker ps -a                 # list all containers (including stopped)
docker images                # list downloaded images
docker stop <container>      # stop a running container
docker rm <container>        # remove a container
docker rmi <image>           # remove an image
docker logs <container>      # view logs
docker exec -it <name> bash  # open a shell inside a container

Try these after running hello-world — most will show nothing, which is correct.

🔧 Troubleshooting

"docker: command not found"

Your PATH doesn't include Docker. On Windows, restart your terminal. On Linux, log out and back in after adding your user to the docker group.

"Cannot connect to the Docker daemon"

The Docker engine isn't running. Open Docker Desktop and wait for it to start. On Linux, run sudo systemctl start docker.

Windows: "WSL 2 installation is incomplete"

Run wsl --install in PowerShell as administrator, then restart. Enable virtualization in BIOS if it still fails.

Mac: Docker Desktop is slow

Increase the memory allocation in Settings → Resources. Also check that you're on Apple Silicon if you have an M-series Mac.

🎯 What's Next?

Now that Docker is running, here's what to learn next:

← All How-To Guides