V9
Velocity9
Docker
Documentation

Docker Installation Guide for Ubuntu, Windows, and macOS

Step-by-step guide to install Docker on Ubuntu, Windows, and macOS, including user setup and verification.


🐳 Docker Installation β€” Complete Setup Guide


🧠 What is Docker?

Docker is a platform used to build, run, and manage containerized applications. It packages code, dependencies, and environment configurations into a single container image, ensuring consistent behavior across systems.


βš™οΈ Step 1: Install Docker on Ubuntu (Linux)

🧩 1. Update and Install Required Packages

sudo apt update
sudo apt install ca-certificates curl gnupg lsb-release -y

🧩 2. Add Docker’s Official GPG Key

sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

🧩 3. Set Up the Docker Repository

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

🧩 4. Install Docker Engine, CLI, and Compose

sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y

🧩 5. Verify Docker Installation

sudo systemctl start docker
sudo systemctl enable docker
docker --version

βœ… Output example:

Docker version 27.0.0, build xxxxxxx

🧩 6. Run Docker Without sudo

By default, Docker requires sudo. To fix this, add your user to the Docker group:

sudo usermod -aG docker $USER && newgrp docker

Then verify:

docker run hello-world

βœ… If it prints β€œHello from Docker!”, your setup works perfectly.


πŸͺŸ Step 2: Install Docker on Windows

🧩 1. Download Docker Desktop

Go to: πŸ‘‰ https://www.docker.com/products/docker-desktop

🧩 2. Install

  • Run the installer (Docker Desktop Installer.exe)
  • Enable WSL 2 and Hyper-V when prompted
  • Complete installation and reboot if required

🧩 3. Verify

Open PowerShell or CMD:

docker --version

Run test container:

docker run hello-world

βœ… You should see the Docker welcome message.


🍏 Step 3: Install Docker on macOS

🧩 1. Download Docker Desktop

Go to: πŸ‘‰ https://www.docker.com/products/docker-desktop

🧩 2. Install

  • Download .dmg file
  • Drag Docker.app to Applications
  • Launch Docker Desktop from Launchpad

🧩 3. Verify

Open Terminal:

docker --version
docker run hello-world

βœ… Output: Docker runs successfully on macOS.


🧰 Step 4: Common Post-Installation Commands

docker ps              # list running containers
docker images          # list images
docker stop <id>       # stop container
docker rm <id>         # remove container
docker rmi <id>        # remove image
docker system prune -a # clean up everything

Need help with this topic?