Fatskills
Practice. Master. Repeat.
Study Guide: Docker Docker Installation and Basics Installing Docker on Linux Windows Mac
Source: https://www.fatskills.com/kubernetes/chapter/docker-docker-installation-and-basics-installing-docker-on-linux-windows-mac

Docker Docker Installation and Basics Installing Docker on Linux Windows Mac

By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.

⏱️ ~3 min read

1. Core Command / Concept

Install Docker on Linux, Windows, and Mac using official installation scripts. curl -sSL https://get.docker.com/ | sh

2. Step-by-Step (numbered)

  1. Check if your system meets the Docker installation requirements: uname -a
  2. Install Docker on Linux (Ubuntu/Debian): sudo apt-get update && sudo apt-get install -y docker.io
  3. Install Docker on Linux (RHEL/CentOS): sudo yum install -y docker
  4. Install Docker on Windows (using WSL): wsl --install -d docker-desktop
  5. Install Docker on Mac (using Homebrew): brew install --cask docker
  6. Start the Docker service: sudo systemctl start docker
  7. Enable Docker to start at boot: sudo systemctl enable docker
  8. Verify Docker installation: docker --version
  9. Clean up: sudo apt-get autoremove ⚠️ This deletes all stopped containers: docker rm $(docker ps -aq)

3. Real Commands with Examples


Example 1: Install Docker on Linux (Ubuntu/Debian)

  • Purpose: Install Docker on Ubuntu/Debian.
  • Command: sudo apt-get update && sudo apt-get install -y docker.io
  • Brief explanation of flags: -y automatically answers yes to all prompts.

Example 2: Install Docker on Windows (using WSL)

  • Purpose: Install Docker on Windows using WSL.
  • Command: wsl --install -d docker-desktop
  • Brief explanation of flags: -d specifies the distribution to install.

Example 3: Install Docker on Mac (using Homebrew)

  • Purpose: Install Docker on Mac using Homebrew.
  • Command: brew install --cask docker
  • Brief explanation of flags: --cask installs a Cask package.

4. Common Errors (3-5)


Error 1: Unable to install Docker due to missing dependencies.

  • Error message or symptom: E: Unable to locate package docker.io
  • Why it happens: The system is missing required dependencies.
  • One-line fix: sudo apt-get update && sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common

Error 2: Docker installation fails due to conflicting packages.

  • Error message or symptom: Error: Package 'docker' is not installed, but is referred to by another package.
  • Why it happens: Another package is trying to install Docker.
  • One-line fix: sudo apt-get install -y docker.io

Error 3: Docker service fails to start.

  • Error message or symptom: Job for docker.service failed because the control process exited with error code.
  • Why it happens: The Docker service is not configured correctly.
  • One-line fix: sudo systemctl restart docker

5. Quick Checks (3 scenarios)


Scenario 1: Check if Docker is installed.

  • Situation: You want to verify if Docker is installed.
  • Command to run: docker --version
  • What a correct response looks like: Docker version 20.10.7, build 20.10.7-0ubuntu5~20.04.2

Scenario 2: Check if Docker is running.

  • Situation: You want to verify if Docker is running.
  • Command to run: sudo systemctl status docker
  • What a correct response looks like: Active: active (running)

Scenario 3: Check Docker version.

  • Situation: You want to verify the Docker version.
  • Command to run: docker version
  • What a correct response looks like: Client: Docker Engine - Community
    Server: Docker Engine - Community

6. Last-Minute Reference

  • Docker installation script: https://get.docker.com/
  • Docker installation package: docker.io
  • Docker service name: docker
  • Docker version command: docker --version
  • Docker version output format: Client: Docker Engine - Community Server: Docker Engine - Community
  • ⚠️ Docker installation requires root privileges.
  • ⚠️ Docker installation may require additional dependencies.
  • ⚠️ Docker service may require manual configuration.


ADVERTISEMENT