Appendix I: Docker Installation

A detailed guide for installing Docker on Windows, Mac, and Linux.

Docker Installation on Windows and Mac

Windows Users

If you are a Windows user, it is recommended to use WSL (Windows Subsystem for Linux) to install Ubuntu. You can refer to Microsoft's official tutorial: https://learn.microsoft.com/en-us/windows/wsl/install

[!NOTE] Ubuntu (IPA: /ʊˈbʊntuː/) is a popular Linux distribution. It has three official editions: Desktop, Server, and Core (for IoT devices and robots). This tutorial primarily uses the Server edition.

After installation, you should see Ubuntu in your Start menu. Open it, and if you see a terminal window with welcome text, the installation is successful!

Install Docker Desktop

  1. Go to the Docker official download page: https://www.docker.com/products/docker-desktop/
  2. Download the Windows version and install it.

Docker Download Guide

[!TIP]

  1. Typically, after installing Docker Desktop for Windows, Docker within your Ubuntu subsystem will also be installed automatically, which is very convenient.
  2. If you encounter issues during installation, you can ask AI or search on Bing. There are many troubleshooting guides and forum posts available online.

Verify Installation

After installation, enter your Ubuntu terminal and run the following command:

docker ps

If you see an output similar to a container list (including CONTAINER ID, IMAGE, COMMAND, etc.), the installation is complete!

Mac Users

Mac command-line operations are almost identical to Linux. Many operations on Mac are exactly the same as on Linux servers, so you can directly use Mac for practice (and even deployment).

  1. Go to the Docker official download page: https://www.docker.com/products/docker-desktop/
  2. Install Docker directly and launch it.

[!IMPORTANT] Chip Selection Guide:

  • Apple Silicon (M-series chips): If you bought your Mac in the last five years (M1, M2, M3, etc.), usually choose Apple Silicon (often the first option).
  • Intel Chip: If you have an older Mac (e.g., with a Touchbar), it likely uses an Intel chip. Choose Intel chip.

If unsure, click the Apple logo in the top-left corner -> "About This Mac" to check.

Mac Docker Download Guide

After downloading, installing, and running the software, you will see a whale icon in the top-right corner of your screen.

Verify Installation

Open the Terminal and run:

docker ps

If you see the output list, Docker is successfully installed!

Linux Server (CentOS / Ubuntu / Debian)

Preparation

  1. Use an SSH tool (like Xshell, FinalShell) to connect to your cloud server (enter IP, username, password).
  2. Test network connectivity: ping google.com (press Ctrl+C to stop). If you see results, the network is working.

Step 1: Confirm Package Manager

Run the following commands to check your system version:

# Check for yum version (CentOS, etc.)
yum --version

# Check for apt version (Ubuntu/Debian, etc.)
apt --version
  • If yum --version has output -> follow the [yum Series] steps below.
  • If apt --version has output -> follow the [apt Series] steps below.

Step 2: Installation Steps by System

【yum Series】

# 3. Update System (Recommended)
yum update -y

# 4. Install Docker Dependencies
yum install -y yum-utils device-mapper-persistent-data lvm2

# 5. Add Docker Official Repository
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

# 6. Install Docker
yum install -y docker-ce docker-ce-cli containerd.io

【apt Series (Ubuntu/Debian)】

# 7. Update System (Recommended)
apt update && apt upgrade -y

# 8. Install Docker Dependencies
apt install -y apt-transport-https ca-certificates curl software-properties-common

# 9. Add Docker Official GPG Key and Repository
# Add Key (Verify software legitimacy)
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
# Add Repository
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

# 10. Install Docker
apt update && apt install -y docker-ce

Step 3: Start Docker and Enable on Boot (Universal)

# Start Docker Service
systemctl start docker

# Enable start on boot (Docker runs automatically after server restart)
systemctl enable docker

Step 4: Verify Installation

Run the following command. If version information is displayed, the installation is successful:

docker --version

Example Output: Docker version 24.0.6, build ed223bc

Common Commands (Universal)

  • Stop Docker: systemctl stop docker
  • Restart Docker: systemctl restart docker
  • View running containers: docker ps
  • View all containers (including stopped): docker ps -a
  • Pull an image (e.g., Nginx): docker pull nginx

[!NOTE] Summary: The core difference lies in the "Installation Steps". Other operations like starting, verifying, and using Docker are exactly the same. Just copy and paste the commands for your corresponding system!