How to Install Docker on Linux, Mac, and Windows

Now that you know what Docker is, the next step is to install it on your computer. The installation process depends on your operating system, but don’t worry — I’ll walk you through step by step.


🐧 Install Docker on Linux

Docker is supported on most Linux distributions (Ubuntu, Debian, CentOS, Fedora, etc.). Here’s the process for Ubuntu/Debian, which is the most common:

Step 1: Update your system

sudo apt update
sudo apt upgrade -y

Step 2: Install required packages

sudo apt install ca-certificates curl gnupg lsb-release -y

Step 3: Add Docker’s official GPG key

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker.gpg

Step 4: Set up the stable repository

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Step 5: Install Docker Engine

sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io -y

Step 6: Verify installation

docker --version

👉 If you see the version, Docker is installed successfully!


🍎 Install Docker on Mac

On macOS, Docker is installed using Docker Desktop.

Steps:

  1. Go to Docker Desktop for Mac.
  2. Download the .dmg file (choose Intel or Apple Silicon version).
  3. Open the file and drag Docker to your Applications folder.
  4. Launch Docker Desktop (you’ll see the whale icon in the menu bar).
  5. Verify installation: docker --version

🖥 Install Docker on Windows

On Windows, you’ll also use Docker Desktop.

Steps:

  1. Go to Docker Desktop for Windows.
  2. Download and run the installer (.exe).
  3. During setup, enable WSL 2 (Windows Subsystem for Linux) if prompted.
  4. Restart your computer.
  5. Open Docker Desktop (whale icon in the taskbar).
  6. Verify installation: docker --version

✅ Common Post-Installation Step

By default, you might need sudo (Linux) or admin rights (Mac/Windows) to run Docker. To avoid that on Linux:

sudo usermod -aG docker $USER
newgrp docker

Now you can run:

docker run hello-world

This will download a test image and confirm your Docker setup is working correctly.


🎯 Final Thoughts

Installing Docker might feel a bit different depending on your system, but once it’s done, you’re ready to build and run containers anywhere.

👉 In the next guide, we’ll cover: Running Your First Docker Container.


💡 Pro Tip: If you get stuck during installation, check the official Docker documentation or feel free to reach out — I also provide Docker training and setup consulting to help you get started quickly.

Scroll to Top