Containerization Fundamentals
Docker operates as an open-source orchestration platform that bundles applications with their required libraries, configuration files, and runtime environments into isolated units. This approach eliminates environment drift, preventing the common scenario where software executes correctly on one machine but fails on another due to mismatched system packages or dependency versions.
Repository Registration
Begin by configuring the system package manager to recognize the official Docker distribution sources. Replace the legacy utility with the modern configuration command:
sudo dnf config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Initial Deployment and SELinux Policy Blocking
Attempting a standard engine installation triggers dependency resolution:
sudo dnf install docker-ce docker-ce-cli containerd.io
On CentOS 8, the transaction frequently aborts due to modular filtering restrictions. The package manager reports an unsatisfied security policy dependency:
Error:
Problem 1: package docker-ce-3:26.1.3-1.el8.x86_64 from docker-ce-stable requires container-selinux >= 2:2.74, but none of the providers can be installed
- cannot install the best candidate for the job
- package container-selinux-2:2.124.0-1... is filtered out by modular filtering
... (additional filtered candidates omitted)
The distrbiution's module system deliberately suppresses the required SELinux policy package. To circumvent this, retrieve the specific RPM from a verified mirror and inject it into the local cache:
curl -O https://mirrors.aliyun.com/centos/8-stream/AppStream/x86_64/os/Packages/container-selinux-2.190.0-1.module_el8.7.0+1152+ac778627.noarch.rpm
sudo dnf localinstall ./container-selinux-*.noarch.rpm
Overcoming Runtime Binary Supersession
Following the manual policy injection, re-initiating the suite installation typically exposes a secondary conflict. The package manager indicates that the incoming container runtime replaces an existing system component:
Error:
Problem 1: package containerd.io-1.6.32-3.1.el8.x86_64 from docker-ce-stable conflicts with runc provided by runc-1:1.1.12-6.module+el8.10.0+2001+6a33db9f.x86_64 from @System
- package containerd.io-1.6.32-3.1.el8.x86_64 from docker-ce-stable obsoletes runc provided by runc-1:1.1.12-6.module+el8.10.0+2001+6a33db9f.x86_64 from @System
This occurs because Docker's integrated runtime supersedes the distribution's legacy binary. The transaction reuqires explicit authorization to remove the conflicting component. Execute the installation command with the --allowerasing directive to force dependency resolution:
sudo dnf install --allowerasing -y \
docker-ce \
docker-ce-cli \
containerd.io \
docker-buildx-plugin \
docker-compose-plugin
Daemon Configuration and Verification
Once the binaries are successfully deployed, configure the service to activate automatically during system initialization:
sudo systemctl enable --now docker.service
Validate the operational state by fetching and executing a lightweight diagnostic image:
docker run --rm hello-world:latest
A successful execution outputs the standard welcome message and diagnostic metadata, confirming that the daemon, client utilities, and container runtime are fully integrated and functional.