How to Install Docker on Windows, Linux, and macOS

Below are step-by-step instructions for installing Docker on each OS, along with links to official documentation for further help.


1. Docker Installation on Windows

  1. Download Docker Desktop:

  2. Run the Installer:

    • Run the downloaded .exe file and follow the on-screen instructions.
    • During installation, select whether to use WSL 2 or Hyper-V as the backend (WSL 2 is recommended if you’re on Windows 10 version 1903 or higher).
  3. Complete the Installation:

    • After installation, open Docker Desktop and go through the setup wizard to finalize settings.
    • Docker will automatically configure to start on boot. You may also enable Kubernetes if you need it.
  4. Verify the Installation:

    • Open a terminal (PowerShell or Command Prompt) and run the command:
      docker --version
      
    • You should see the Docker version number if the installation was successful.
  5. Additional Information:


2. Docker Installation on Linux

Docker is available on most Linux distributions. Here's a general guide, with specifics for Ubuntu as an example.

  1. Update Package Index:

    • Open your terminal and update the package list.
      sudo apt-get update
      
  2. Install Required Packages:

    • Install necessary prerequisites to allow apt to use repositories over HTTPS:
      sudo apt-get install \
        ca-certificates \
        curl \
        gnupg \
        lsb-release
      
  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. Set Up the Repository:

    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. Install Docker Engine:

    sudo apt-get update
    sudo apt-get install docker-ce docker-ce-cli containerd.io
    
  6. Start Docker:

    • Start the Docker service:
      sudo systemctl start docker
      
    • Enable Docker to start on boot:
      sudo systemctl enable docker
      
  7. Verify the Installation:

    docker --version
    
  8. Further Information:


3. Docker Installation on macOS

  1. Download Docker Desktop for macOS:

  2. Install Docker Desktop:

    • Open the .dmg file and drag the Docker icon to the Applications folder.
    • Open Docker from Applications, which will start the installation process.
  3. Follow the Setup Wizard:

    • Go through any initial configuration setup, and Docker Desktop should start automatically after the installation.
  4. Verify the Installation:

    • Open a terminal and run:
      docker --version
      
    • If the version number displays, your installation was successful.
  5. Additional Information:


With Docker installed, you can start building, sharing, and running containerized applications across any environment! Let us know if you have questions or need additional help.