Docker is the key to packaging, distributing, and running applications consistently across any environment. Whether you are an experienced developer or a complete beginner, installing Docker is the first and most important step.
This article provides a step-by-step guide to installing Docker Desktop on Windows and macOS, and Docker Engine on the most popular Linux distributions (Ubuntu, CentOS, Debian). Let’s start your journey to mastering container technology now! 🚀
🐳 Installing Docker on Windows: Simple and Intuitive
For Docker Desktop, Windows users get a friendly graphical interface and deep system integration, especially the choice between WSL 2 (Windows Subsystem for Linux 2) and Hyper-V as the backend.
System Requirements
Before you begin, make sure your computer meets the following requirements:
- Operating System: Windows 10 64-bit (version 1903 or later) or Windows 11 64-bit.
- WSL 2: Must be enabled. This is the recommended method for best performance.
- CPU: Hardware virtualization support (Virtualization) must be enabled in BIOS.
- RAM: At least 4 GB.
Installation Steps
-
Enable WSL 2 and Virtual Machine Platform: Open PowerShell as Administrator and run the following commands:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
After running these commands, restart your computer.
-
Download Docker Desktop: Go to the official Docker website to download the latest installer for Windows.
-
Run the installer: Open the
.exe
file you just downloaded. The installation process is straightforward—just follow the on-screen instructions. Make sure the option "Use WSL 2 instead of Hyper-V" is selected. -
Finish and restart: After installation, Docker Desktop may ask you to restart your computer again.
-
Verify installation: When Docker Desktop is running (the whale 🐳 icon appears in the system tray), open Command Prompt or PowerShell and type:
docker --version
If you see the Docker version information, congratulations—you’ve installed Docker successfully!
🍏 Installing Docker on macOS: Seamless Integration
Like Windows, Docker Desktop on macOS offers a smooth experience and deep OS integration, leveraging Apple’s HyperKit virtualization framework.
System Requirements
- macOS: Version 10.15 (Catalina) or later.
- Chip: Supports both Intel and Apple Silicon (M1, M2, etc.).
- RAM: At least 4 GB.
Installation Steps
-
Download Docker Desktop: Visit the official Docker website and choose the version that matches your Mac’s chip (Intel or Apple Silicon).
-
Run the installer: Open the
Docker.dmg
file you downloaded. Drag and drop the Docker icon into your Applications folder. -
Launch Docker: Open Docker from the Applications folder. The first time you run it, Docker will request access and perform some initial setup.
-
Verify installation: Once the Docker 🐳 icon appears in the menu bar and is "running", open the Terminal app and type:
docker run hello-world
This command downloads a small image and runs a simple container. If you see the message "Hello from Docker!", you’ve installed Docker successfully.
🐧 Docker Engine for Linux: Power and Flexibility
On Linux, we’ll install Docker Engine, the powerful command-line version and the backbone of Docker. Here are detailed instructions for the most popular distributions.
1. Ubuntu
Installing Docker on Ubuntu via the official repository is recommended to ensure you always get the latest updates.
-
Remove old versions (if any):
sudo apt-get remove docker docker-engine docker.io containerd runc
-
Set up the repository:
sudo apt-get update sudo apt-get install -y ca-certificates curl gnupg lsb-release sudo mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
-
Install Docker Engine:
sudo apt-get update sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
-
Configure Docker to run without
sudo
(recommended): Add your current user to thedocker
group:sudo groupadd docker sudo usermod -aG docker $USER
Note: You need to log out and log back in or restart your computer for this change to take effect.
-
Verify installation:
docker run hello-world
2. CentOS
Like Ubuntu, we’ll use Docker’s official repository.
-
Remove old versions (if any):
sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine
-
Set up the repository:
sudo yum install -y yum-utils sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
-
Install Docker Engine:
sudo yum install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
-
Start Docker:
sudo systemctl start docker sudo systemctl enable docker # Start Docker automatically on boot
-
Configure Docker to run without
sudo
(recommended):sudo groupadd docker sudo usermod -aG docker $USER
Note: Log out and log back in to apply the change.
-
Verify installation:
docker run hello-world
3. Debian
The steps for Debian are very similar to Ubuntu.
-
Remove old versions:
sudo apt-get remove docker docker-engine docker.io containerd runc
-
Set up the repository:
sudo apt-get update sudo apt-get install -y ca-certificates curl gnupg lsb-release sudo mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
-
Install Docker Engine:
sudo apt-get update sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
-
Configure Docker to run without
sudo
and verify: Do the same as on Ubuntu.
Conclusion: Installing Docker is No Longer a Barrier
With this detailed guide, installing Docker is no longer a barrier. From now on, you have the most powerful containerization tool at your disposal, ready to deploy your applications efficiently and professionally.
Your Docker journey is just beginning. Explore Docker Hub, learn to write Dockerfiles, and master Docker Compose to take your projects to the next level. Good luck!