{x}
blog image

Installing Docker on Windows macOS and Linux

Installing Docker on Windows, macOS, and Linux

This guide provides a comprehensive walkthrough for installing Docker on various operating systems, including Windows, macOS, and Linux. Docker is a powerful platform for developing, shipping, and running applications in containers, offering benefits like portability, consistency, and isolation.

Windows

System Requirements:

  • Windows 10 64-bit Pro, Enterprise, or Education (Build 15063 or later). Windows 10 Home requires enabling Hyper-V and WSL 2.
  • Hardware virtualization support in the BIOS.

Installation Steps:

  1. Download Docker Desktop for Windows from the official Docker website.
  2. Run the installer and follow the on-screen instructions. Ensure that the "Use WSL 2 based engine" option is selected during installation.
  3. After installation, Docker Desktop will start automatically. You can verify the installation by opening a command prompt or PowerShell and running docker --version.

macOS

System Requirements:

  • macOS 10.15 Catalina or newer. Older macOS versions are not supported.
  • Intel chip with hardware virtualization support or Apple Silicon.

Installation Steps:

  1. Download Docker Desktop for Mac from the official Docker website.
  2. Open the downloaded .dmg file and drag the Docker application to the Applications folder.
  3. Start Docker Desktop from the Applications folder. You can verify the installation by opening a terminal and running docker --version.

Linux

Docker installation on Linux varies depending on the distribution. Here's a general outline for Debian-based distributions like Ubuntu:

System Requirements:

  • A 64-bit Linux distribution.
  • Kernel version 3.10 or higher is recommended.

Installation Steps (Ubuntu):

  1. Update the apt package index:
    sudo apt update
  2. Install required packages:
    sudo apt install apt-transport-https ca-certificates curl gnupg lsb-release software-properties-common
  3. Add Docker's official GPG key:
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  4. Add the Docker repository to APT sources:
    echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  5. Update the apt package index again:
    sudo apt update
  6. Install the Docker Engine, CLI, and containerd:
    sudo apt install docker-ce docker-ce-cli containerd.io
  7. Verify the installation:
    sudo docker run hello-world

Troubleshooting:

  • Docker Desktop not starting: Check for virtualization support in BIOS settings and ensure that Hyper-V or WSL 2 is enabled (Windows) or that Docker is running from the Applications folder (macOS).
  • Docker commands not working: Ensure that Docker Desktop is running or that the Docker daemon is running on Linux. Try restarting the Docker service.
  • Image pull errors: Check your network connection and ensure that you're using the correct image name and tag.

This detailed guide will help you get Docker up and running on your preferred operating system. For more specific instructions or troubleshooting steps related to your distribution, refer to the official Docker documentation.