Installing Docker

In this lesson, you’ll learn how to install Docker on different operating systems.

Prerequisites

  • A computer with Windows, macOS, or Linux
  • Administrator/sudo access
  • At least 4GB of RAM

Installation Steps

For macOS

  1. Download Docker Desktop from the official website
  2. Open the downloaded .dmg file
  3. Drag Docker to Applications folder
  4. Launch Docker from Applications

For Windows

  1. Enable WSL 2 feature
  2. Download Docker Desktop for Windows
  3. Run the installer
  4. Restart your computer

For Linux (Ubuntu)

# Update package index
sudo apt-get update

# Install required packages
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common

# Add Docker's GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

# Add Docker repository
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

# Install Docker
sudo apt-get update
sudo apt-get install docker-ce

Verify Installation

After installation, verify Docker is working:

docker --version
docker run hello-world

Next Steps

Now that Docker is installed, we’ll move on to understanding Docker images in the next lesson.