Docker Engine Installation Guide: Linux, Mac, Windows, and Supported Platforms
Docker Engine is the backbone of containerization, enabling you to build, ship, and run applications in isolated environments. This comprehensive guide will walk you through the installation process on various operating systems, ensuring a smooth setup and optimal performance.
Table of Contents
- Introduction to Docker Engine
- Supported Platforms
- Installation on Linux
- Installation on Mac
- Installation on Windows
- Upgrading Docker Engine
- Uninstalling Docker Engine
- Troubleshooting
- Getting Started
Introduction to Docker Engine
Docker Engine is a client-server application comprising:
- dockerd: A persistent daemon that manages Docker images, containers, networks, and volumes.
- Docker CLI: A command-line interface (CLI) client that allows you to interact with the daemon.
- Docker API: A REST API used by applications to interact with the Docker daemon.
Supported Platforms
Docker Engine is available for the following platforms:
Platform | x86_64 / amd64 | arm64 / aarch64 | arm (32-bit) | ppc64le | s390x |
---|---|---|---|---|---|
CentOS | ✅ | ✅ | ✅ | ||
Debian | ✅ | ✅ | ✅ | ✅ | |
Fedora | ✅ | ✅ | ✅ | ||
Raspberry Pi OS (32-bit) | ✅ | ||||
RHEL | ✅ | ✅ | ✅ | ||
SLES | ✅ | ||||
Ubuntu | ✅ | ✅ | ✅ | ✅ | ✅ |
Binaries | ✅ | ✅ | ✅ |
Installation on Linux
Prerequisites
- A 64-bit version of a supported Linux distribution (CentOS, Debian, Fedora, RHEL, Ubuntu, SLES).
- Root privileges or
sudo
access. - Internet connection for downloading packages.
Installation Methods
Using the Repository
This is the recommended method for installing Docker Engine on Linux.
-
Set up the repository:
-
Debian/Ubuntu:
sudo apt-get update sudo apt-get install ca-certificates curl gnupg 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 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 sudo apt-get update
-
CentOS/RHEL/Fedora:
sudo dnf install -y dnf-plugins-core sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
-
SLES:
sudo zypper addrepo https://download.docker.com/linux/sles/docker-ce.repo
-
-
Install Docker Engine:
-
Latest Version:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin # Debian/Ubuntu sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin # CentOS/RHEL/Fedora sudo zypper install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin # SLES
-
Specific Version:
# List available versions apt-cache madison docker-ce # Debian/Ubuntu dnf list docker-ce --showduplicates | sort -r # CentOS/RHEL/Fedora zypper search -s --match-exact docker-ce | sort -r # SLES # Install specific version sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io docker-buildx-plugin docker-compose-plugin # Debian/Ubuntu sudo dnf install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io docker-buildx-plugin docker-compose-plugin # CentOS/RHEL/Fedora sudo zypper install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io docker-buildx-plugin docker-compose-plugin # SLES
-
-
Start Docker Engine:
sudo systemctl start docker sudo systemctl enable docker
-
Verify Installation:
sudo docker run hello-world
From a Package
This method is suitable for air-gapped systems or when a direct repository connection is unavailable.
-
Download the
.deb
or.rpm
package:- Visit https://download.docker.com/linux/ and navigate to the appropriate distribution and version.
- Download the
docker-ce
,docker-ce-cli
, andcontainerd.io
packages.
-
Install the Package:
-
Debian/Ubuntu:
sudo dpkg -i ./containerd.io_<version>_<arch>.deb sudo dpkg -i ./docker-ce_<version>_<arch>.deb sudo dpkg -i ./docker-ce-cli_<version>_<arch>.deb
-
CentOS/RHEL/Fedora:
sudo rpm -ivh ./containerd.io-<version>.<arch>.rpm sudo rpm -ivh ./docker-ce-<version>.<arch>.rpm sudo rpm -ivh ./docker-ce-cli-<version>.<arch>.rpm
-
SLES:
sudo zypper install ./containerd.io-<version>.<arch>.rpm sudo zypper install ./docker-ce-<version>.<arch>.rpm sudo zypper install ./docker-ce-cli-<version>.<arch>.rpm
-
-
Start Docker Engine:
sudo systemctl start docker sudo systemctl enable docker
-
Verify Installation:
sudo docker run hello-world
Using the Convenience Script
Warning: This method is intended for testing and development environments only.
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
Post-Installation Steps
- Manage Docker as a Non-Root User: Create a
docker
group and add your user to it to avoid usingsudo
. - Configure Docker to Start on Boot: Use
systemctl enable docker
to ensure Docker starts automatically on system startup. - Configure Default Logging Driver: Consider using a logging driver with log rotation to prevent disk space exhaustion.
Installation on Mac
The preferred way to run Docker on Mac is via Docker Desktop for Mac. Docker Desktop provides a complete development environment, including the Docker Engine, Docker CLI, Docker Compose, Kubernetes, and more.
- Download Docker Desktop for Mac: Visit the Docker website and download the installer.
- Install Docker Desktop: Double-click the downloaded
.dmg
file and follow the on-screen instructions. - Start Docker Desktop: Launch Docker Desktop from the Applications folder.
- Verify Installation: Open a terminal and run
docker run hello-world
.
Installation on Windows
The recommended way to run Docker on Windows is using Docker Desktop for Windows. Docker Desktop provides a complete development environment, including the Docker Engine, Docker CLI, Docker Compose, Kubernetes, and more.
- Download Docker Desktop for Windows: Visit the Docker website and download the installer.
- Install Docker Desktop: Double-click the downloaded
.exe
file and follow the on-screen instructions. - Start Docker Desktop: Launch Docker Desktop from the Start menu.
- Verify Installation: Open a PowerShell or Command Prompt and run
docker run hello-world
.
Upgrading Docker Engine
Follow the installation steps for your chosen method (repository or package) to upgrade to a newer version.
Uninstalling Docker Engine
-
Stop Docker Engine:
sudo systemctl stop docker
-
Uninstall Packages:
- Debian/Ubuntu:
sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-compose-plugin
- CentOS/RHEL/Fedora:
sudo dnf remove docker-ce docker-ce-cli containerd.io docker-compose-plugin
- SLES:
sudo zypper remove docker-ce docker-ce-cli containerd.io docker-compose-plugin
- Debian/Ubuntu:
-
Remove Data:
sudo rm -rf /var/lib/docker
Troubleshooting
- Permission Denied: Ensure your user is in the
docker
group. - Docker Daemon Not Running: Check the daemon's status using
systemctl status docker
. - Network Issues: Verify firewall settings and network configurations.
Getting Started
After successfully installing Docker Engine, explore these resources:
- Docker Documentation: https://docs.docker.com/
- Docker Hub: https://hub.docker.com/
- Docker Get Started Tutorial: https://docs.docker.com/get-started/
By following this guide, you'll have a fully functional Docker Engine environment ready for building, deploying, and managing your containerized applications. Remember to consult the official Docker documentation for the most up-to-date information and advanced configurations.