Docker Installation

Installing Docker is the first step to using its containerization features for efficient application deployment. This tutorial provides step-by-step instructions to install Docker on Windows, macOS, and Linux, along with methods to verify the installation and ensure Docker is set up correctly on your system.



Prerequisites

Before you install Docker, make sure your system meets the following requirements:

  • Windows: Windows 10 (Pro, Enterprise, Education) or Windows 11 with WSL2 enabled.
  • macOS: macOS 10.15 or later.
  • Linux: A 64-bit distribution such as Ubuntu, Debian, Fedora, or CentOS.

​You can download Docker Desktop, the official Docker application for Windows, macOS, and Linux, from the Docker Desktop product page. This page provides installers for various platforms, ensuring you get the version compatible with your operating system.​

For detailed installation instructions and system requirements, refer to the Get Docker page in the Docker documentation. This resource offers step-by-step guidance to ensure a smooth installation process.


Installing Docker on Windows

  • Download Docker Desktop from the official website.
  • Run the installer and follow the setup wizard, selecting WSL 2 as the backend (recommended).
  • Open Docker Desktop and wait for it to initialize.
  • Verify installation by running the following command in Command Prompt (cmd) or PowerShell:
    docker --version
    

Installing Docker on macOS

  • Download Docker Desktop from the Docker website (choose the correct version for Apple Silicon or Intel).
  • Open the downloaded .dmg file and drag Docker to the Applications folder.
  • Launch Docker from the Applications folder and grant necessary permissions.
  • Verify installation using:
    docker --version
    

Installing Docker on Linux

Step 1: Update System Packages

Run the following commands to update your package index:

sudo apt update && sudo apt upgrade -y  # For Debian/Ubuntu
sudo dnf update -y  # For Fedora

Step 2: Install Docker

For Ubuntu/Debian:

sudo apt install docker.io -y

For Fedora:

sudo dnf install docker -y

For CentOS:

sudo yum install docker -y

Step 3: Start and Enable Docker

After installation, start and enable Docker with:

sudo systemctl start docker
sudo systemctl enable docker

Step 4: Verify Installation

Check the installed version by running:

docker --version

To test Docker, run:

sudo docker run hello-world

If the installation is successful, you will see a message confirming that Docker is running.

Post-Installation (Linux Users)

By default, Docker requires sudo to run. To allow running Docker without sudo:

sudo usermod -aG docker $USER

Log out and log back in for changes to take effect.

Conclusion

You have successfully installed Docker on Windows, macOS, or Linux. With Docker set up, you can now start using it to run and manage containers. In the next tutorial, Docker Images & Containers, you will learn how to create, pull, and manage Docker images and containers efficiently.



Found This Page Useful? Share It!
Get the Latest Tutorials and Updates
Join us on Telegram

Keep W3schools Growing with Your Support!
❤️ Support W3schools