You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Getting Docker running on your machine is the first practical step. Docker provides different installation packages depending on your operating system. This lesson covers installation on the three major platforms and verifies that everything works correctly.
Docker Desktop is the recommended way to install Docker on macOS and Windows. It bundles the Docker Engine, Docker CLI, Docker Compose, and a graphical interface into a single installer. On Linux, Docker Engine can be installed directly without Docker Desktop, though Docker Desktop for Linux is also available.
Download Docker Desktop from https://www.docker.com/products/docker-desktop.
# Option 1: Download the .dmg from docker.com and drag to Applications
# Option 2: Install with Homebrew
brew install --cask docker
# After installation, open Docker Desktop from Applications
# Wait for the whale icon in the menu bar to stop animating
# Verify the installation
docker --version
docker run hello-world
The first time Docker Desktop launches it may ask for your password to install a privileged helper. This is normal — Docker needs elevated permissions to manage the Linux VM it runs in the background.
On Windows 10 or 11, Docker Desktop uses the Windows Subsystem for Linux 2 (WSL 2) backend by default, which provides better performance and compatibility than the older Hyper-V backend.
# Prerequisites: enable WSL 2
# Run in PowerShell as Administrator:
wsl --install
# Then download and run the Docker Desktop installer from docker.com
# After installation, verify from PowerShell or a WSL terminal:
docker --version
docker run hello-world
On Linux you install the Docker Engine directly. The exact commands vary by distribution; the following example uses Ubuntu:
# Remove any old Docker packages
sudo apt-get remove docker docker-engine docker.io containerd runc
# Install prerequisites
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg lsb-release
# 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
# Add 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
# Install Docker Engine
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
# Add your user to the docker group so you don't need sudo
sudo usermod -aG docker ${USER}
newgrp docker
# Verify
docker --version
docker run hello-world
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.