Ayush Porwal

Complete Guide to Docker Installation: Engine, CLI & Desktop

A comprehensive guide covering Docker Engine, Docker CLI, and Docker Desktop installation across different platforms with alternatives comparison.

dockerdevopscontainerslinuxmacoswindows

Introduction#

Docker has revolutionized how we develop, ship, and run applications. Whether you’re a developer spinning up local environments, a DevOps engineer managing CI/CD pipelines, or a system administrator deploying production workloads, understanding Docker’s installation options is crucial.

In this guide, we’ll cover the three main components of the Docker ecosystem:

  1. Docker Engine - The core runtime that runs containers
  2. Docker CLI - The command-line interface to interact with Docker
  3. Docker Desktop - The GUI application that bundles everything together

Let’s dive in and explore how installation differs across platforms, along with alternatives you might consider.

Understanding Docker Architecture#

Before installing, it’s important to understand how these components work together:

┌───────────────────────────────────────────────┐
│              Docker Desktop                   │
│  ┌─────────────────────────────────────────┐  │
│  │             Docker CLI                  │  │
│  │  ┌───────────────────────────────────┐  │  │
│  │  │          Docker Engine            │  │  │
│  │  │  ┌─────────────┐ ┌─────────────┐  │  │  │
│  │  │  │ containerd  │ │    runc     │  │  │  │
│  │  │  └─────────────┘ └─────────────┘  │  │  │
│  │  └───────────────────────────────────┘  │  │
│  └─────────────────────────────────────────┘  │
└───────────────────────────────────────────────┘
  • Docker Engine (dockerd): The daemon that manages containers, images, networks, and volumes
  • containerd: The container runtime that Docker Engine uses under the hood
  • runc: The low-level container runtime that actually creates containers
  • Docker CLI: The docker command you use in your terminal
  • Docker Desktop: A GUI wrapper that includes all of the above plus extras

Part 1: Docker Engine#

What is Docker Engine?#

Docker Engine is the core component that actually runs containers. It consists of:

  • dockerd - The Docker daemon
  • containerd - Container runtime
  • REST API - For programmatic access
  • Networking and storage drivers

When to use Engine only:

  • Production servers
  • CI/CD pipelines
  • Headless systems
  • When you need minimal overhead

Installation on Linux#

Ubuntu / Debian#

# Update package index
sudo apt-get update
 
# Install prerequisites
sudo apt-get install ca-certificates curl gnupg
 
# Add Docker's official GPG key
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
  sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
 
# Add the repository
echo \ 
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \  # [!code ++]
  https://download.docker.com/linux/ubuntu \  # [!code ++]
  $(. /etc/os-release && echo "$VERSION_CODENAME") 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

Fedora / RHEL / CentOS#

# Install dnf-plugins-core
sudo dnf -y install dnf-plugins-core
 
# Add Docker repository
sudo dnf config-manager --add-repo \ 
  https://download.docker.com/linux/fedora/docker-ce.repo
 
# Install Docker Engine
sudo dnf install docker-ce docker-ce-cli containerd.io
 
# Start and enable Docker
sudo systemctl start docker
sudo systemctl enable docker

Arch Linux#

# Install from official repositories
sudo pacman -S docker
 
# Start and enable
sudo systemctl start docker
sudo systemctl enable docker

Post-Installation Steps#

After installing Docker Engine, you’ll want to configure it properly:

# Add your user to the docker group (avoid using sudo)
sudo usermod -aG docker $USER  
 
# Apply the new group membership
newgrp docker
 
# Verify installation
docker run hello-world

Security Note: Adding a user to the docker group grants root-equivalent privileges. Only do this for trusted users.

Configure Docker to Start on Boot#

# Enable Docker service
sudo systemctl enable docker.service
sudo systemctl enable containerd.service

Part 2: Docker CLI#

What is Docker CLI?#

The Docker CLI (docker command) is your primary interface for interacting with Docker Engine. It communicates with the Docker daemon via REST API.

Key Commands Overview#

# Container Lifecycle
docker run nginx              # Create and start a container
docker start <container>      # Start a stopped container
docker stop <container>       # Stop a running container  
docker rm <container>         # Remove a container
 
# Image Management
docker pull ubuntu:22.04      # Download an image
docker build -t myapp .       # Build an image from Dockerfile  
docker push myrepo/myapp      # Push to registry
docker images                 # List local images
 
# Inspection
docker ps                     # List running containers  
docker ps -a                  # List all containers  
docker logs <container>       # View container logs
docker inspect <container>    # Detailed container info

Docker Compose CLI#

Docker Compose is included with modern Docker installations:

# Start services defined in docker-compose.yml
docker compose up -d
 
# Stop and remove services
docker compose down
 
# View logs
docker compose logs -f
 
# Scale services
docker compose up -d --scale web=3

CLI Configuration Tips#

Set up Docker context for remote engines:

# Create a context for remote Docker host
docker context create remote-server \ 
  --docker "host=ssh://user@remote-host"
 
# Switch to remote context
docker context use remote-server
 
# Run commands on remote Docker
docker ps  # Now runs on remote-server!

Useful aliases for your shell:

# Add to ~/.bashrc or ~/.zshrc
alias d='docker'
alias dc='docker compose'
alias dps='docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"'
alias dlog='docker logs -f'

Part 3: Docker Desktop#

What is Docker Desktop?#

Docker Desktop is an all-in-one application that includes:

  • Docker Engine
  • Docker CLI
  • Docker Compose
  • Kubernetes (optional)
  • GUI for container management
  • Extensions marketplace
  • Automatic updates

macOS Installation#

Download and Install:

  1. Download from docker.com/products/docker-desktop
  2. Open the .dmg file
  3. Drag Docker to Applications folder
  4. Launch Docker from Applications

Apple Silicon vs Intel:

# Check your chip architecture
uname -m
 
# Output:
# arm64 = Apple Silicon (M1/M2/M3)  
# x86_64 = Intel  

Docker Desktop natively supports both architectures. For Apple Silicon:

  • Native ARM containers run fastest
  • Intel containers run via Rosetta 2 (slower but compatible)
  • Some images may not have ARM variants yet

Resource Configuration:

Docker Desktop → Settings → Resources:

  • CPUs: Allocate based on your workload (default: half of available)
  • Memory: 4GB minimum, 8GB+ recommended for development
  • Disk: Docker images can grow large; allocate accordingly

Windows Installation#

Prerequisites:

  • Windows 10/11 (64-bit) Pro, Enterprise, or Education
  • WSL 2 enabled (recommended) OR Hyper-V

WSL 2 Backend (Recommended):

# Enable WSL
wsl --install  
 
# Set WSL 2 as default
wsl --set-default-version 2
 
# Install a Linux distribution
wsl --install -d Ubuntu

Then download Docker Desktop from docker.com and install.

WSL Integration:

Docker Desktop → Settings → Resources → WSL Integration:

  • Enable integration with your WSL distros
  • Access Docker from within WSL without extra configuration
# Inside WSL Ubuntu
docker ps  # Works directly!  

Windows Containers vs Linux Containers:

# Switch to Windows containers (right-click Docker icon)
# Or via CLI:
& $Env:ProgramFiles\Docker\Docker\DockerCli.exe -SwitchDaemon
 
# Check current mode
docker version --format '{{.Server.Os}}'

Note: Most development uses Linux containers. Windows containers are mainly for legacy Windows applications.

Linux Installation (Docker Desktop)#

Docker Desktop is also available for Linux (DEB/RPM packages):

# Ubuntu/Debian
sudo apt-get install ./docker-desktop-<version>-amd64.deb
 
# Fedora
sudo dnf install ./docker-desktop-<version>-x86_64.rpm

When to use Desktop on Linux:

  • You want the GUI management interface
  • You need Kubernetes integration
  • Unified experience across team (Mac/Windows/Linux)

When to skip it:

  • Servers (use Engine only)
  • Resource-constrained systems
  • When you prefer CLI-only workflow

Docker Desktop Licensing#

Docker Desktop licensing changed in 2021:

Use CaseLicense
Personal useFree
EducationFree
Small business (<250 employees, <$10M revenue)Free
Large enterprisesPaid subscription required

This is why alternatives have gained popularity…

Alternatives Comparison#

For macOS#

ToolProsCons
Docker DesktopOfficial, full-featured, K8s includedResource heavy, licensing for enterprise
ColimaLightweight, free, CLI-focusedNo GUI, requires some setup
Rancher DesktopFree, K8s-focused, GUI includedUses nerdctl by default (different CLI)
Podman DesktopDaemonless, rootless, OCI-compliantSome Docker compatibility quirks
OrbStackFast, lightweight, excellent UXPaid for commercial use

Colima Quick Start:

# Install via Homebrew
brew install colima docker
 
# Start Colima with Docker runtime
colima start
 
# Use Docker CLI as normal
docker ps
docker run hello-world

OrbStack (if you want speed):

# Install
brew install orbstack
 
# It just works - Docker CLI is available immediately
docker run -d -p 80:80 nginx

For Windows#

ToolProsCons
Docker DesktopBest WSL2 integration, officialResource usage, licensing
Rancher DesktopFree, K8s includedNewer, less mature on Windows
Podman DesktopDaemonless architectureWSL required, compatibility issues
WSL + Docker EngineFull control, completely freeManual setup required, no GUI

WSL + Docker Engine (Free Alternative):

# Inside WSL Ubuntu
# Follow Linux Docker Engine installation above
 
# Then from Windows, use WSL to run Docker
wsl docker ps

For Linux#

ToolProsCons
Docker Engine (native)Best performance, officialCLI only
PodmanDaemonless, rootless, drop-in replacementMinor compatibility differences
Docker DesktopGUI, unified experienceRuns in VM (overhead), licensing
Rancher DesktopGUI, K8s includedVM overhead

Podman as Docker Alternative:

# Install Podman
sudo apt install podman  # Debian/Ubuntu
sudo dnf install podman  # Fedora
 
# Podman commands mirror Docker  
podman run hello-world
podman ps
 
# Create alias for full compatibility
alias docker=podman

Key Podman differences:

  • Daemonless: No background service required
  • Rootless: Runs containers without root privileges
  • Pod support: Native Kubernetes pod concept
  • Docker-compatible: Most Docker commands work directly

Recommendations by Use Case#

For Local Development#

PlatformRecommendation
macOSDocker Desktop (convenience) or OrbStack (performance)
WindowsDocker Desktop with WSL 2
LinuxNative Docker Engine

For CI/CD Pipelines#

# GitHub Actions example
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Build Docker image
        run: docker build -t myapp .
      - name: Run tests
        run: docker run myapp npm test

Use Docker Engine only - no Desktop needed in CI environments.

For Kubernetes Development#

ToolK8s Support
Docker DesktopBuilt-in single-node cluster
Rancher DesktopK3s (lightweight K8s)
minikubeFull K8s, multiple drivers
kindK8s in Docker containers

For Enterprise/Production Servers#

# Production: Docker Engine only
# Never install Docker Desktop on servers
 
# Security hardening
sudo systemctl enable docker
sudo usermod -aG docker deploy-user  # Specific user only  
 
# Configure logging driver
cat <<EOF | sudo tee /etc/docker/daemon.json
{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3"
  }
}
EOF
 
sudo systemctl restart docker

Troubleshooting Common Issues#

Permission Denied#

# Error: permission denied while trying to connect to Docker daemon
 
# Solution 1: Add user to docker group
sudo usermod -aG docker $USER  
newgrp docker
 
# Solution 2: Check Docker socket permissions
ls -la /var/run/docker.sock
# Should be: srw-rw---- 1 root docker

Docker Daemon Not Running#

# Check status
sudo systemctl status docker
 
# Start if stopped
sudo systemctl start docker
 
# Check logs for errors
sudo journalctl -u docker.service -n 50

Resource Issues (Docker Desktop)#

# Check resource usage
docker system df
 
# Clean up unused resources
docker system prune -a
 
# Remove all stopped containers
docker container prune
 
# Remove unused images
docker image prune -a

Network Conflicts#

# Check Docker networks
docker network ls
 
# Inspect network
docker network inspect bridge
 
# If conflicts with host network, use custom network
docker network create --subnet=172.20.0.0/16 custom-net
docker run --network custom-net myapp

Conclusion#

Choosing the right Docker installation depends on your use case:

  • Docker Engine: Production servers, CI/CD, minimal overhead
  • Docker CLI: Always included, your primary interface
  • Docker Desktop: Development machines, GUI management, K8s integration

For enterprises concerned about licensing, Podman, Colima, or Rancher Desktop are excellent free alternatives that maintain Docker compatibility.

The container ecosystem continues to evolve, but the core concepts remain the same. Whether you choose Docker, Podman, or another runtime, you’re embracing a powerful paradigm for building and deploying applications.

Resources#