Installing Docker
In this lesson by Online Learner, you will learn how to install Docker on Windows, macOS, and Linux (Ubuntu) step by step.
Install Docker on Windows
-
Download Docker Desktop:
- Visit https://www.docker.com/products/docker-desktop/
- Click Download for Windows.
-
Run the Installer:
- Double-click the downloaded
.exefile. - Follow the installation wizard and click Install.
- Make sure WSL 2 (Windows Subsystem for Linux) is enabled.
- Double-click the downloaded
-
Verify Installation:
docker --versionExpected output:
Docker version 25.0.3, build 4debf41
Install Docker on macOS
-
Download Docker Desktop for Mac:
- Visit https://www.docker.com/products/docker-desktop/
- Choose Mac with Apple Silicon or Mac with Intel Chip.
-
Install:
- Open the downloaded
.dmgfile. - Drag the Docker icon to your Applications folder.
- Open Docker from Applications and follow the setup steps.
- Open the downloaded
-
Verify Installation:
docker --version
Install Docker on Ubuntu (Linux)
-
Update package index:
sudo apt update -
Install required dependencies:
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y -
Add Docker GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg -
Add Docker 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 -
Install Docker:
sudo apt update sudo apt install docker-ce docker-ce-cli containerd.io -y -
Start and Enable Docker:
sudo systemctl start docker sudo systemctl enable docker -
Verify Installation:
docker --version docker run hello-world
Run Docker Without sudo (Linux)
sudo usermod -aG docker $USER
newgrp docker
Log out and back in for this change to take effect.
Useful Post-Install Commands
| Command | Description |
|---|---|
docker --version |
Check Docker version |
docker info |
Detailed Docker info |
docker run hello-world |
Test Docker installation |
sudo systemctl status docker |
Check Docker service status (Linux) |
Summary
- Docker Desktop is available for Windows and macOS.
- On Linux, Docker is installed via the terminal using
apt. - Always verify with
docker --versionanddocker run hello-world.
Your Feedback
Help us improve by sharing your thoughts
Online Learner helps developers master programming, database concepts, interview preparation, and real-world implementation through structured learning paths.
Quick Links
© 2023 - 2026 OnlineLearner.in | All Rights Reserved.
