Cloud Native 5 min read

How to Install and Configure Docker on CentOS 7

This guide walks through installing Docker CE on a CentOS 7 system, covering prerequisite kernel checks, repository configuration, package installation, verification with hello‑world, common troubleshooting, and clean removal steps, while explaining core Docker concepts such as images, containers, and registries.

The Dominant Programmer
The Dominant Programmer
The Dominant Programmer
How to Install and Configure Docker on CentOS 7

Overview of Docker

Docker is an open‑source application container engine written in Go and released under the Apache 2.0 license. It lets developers package an application together with its dependencies into a lightweight, portable container that can run on any mainstream Linux host with minimal performance overhead, using sandbox isolation similar to iPhone apps.

Key Docker Concepts

Image : a read‑only template that can be instantiated as a container (e.g., a Tomcat image can be run to create a Tomcat container). Multiple containers can be created from the same image.

Container : an isolated runtime environment created from an image; it behaves like a minimal Linux system.

Repository : a storage location for images, available as public (e.g., Docker Hub) or private registries, analogous to Git repositories.

Installation Procedure on CentOS 7

1. Ensure the kernel version is 3.0 or higher: uname -r 2. Install required utilities: yum install -y yum-utils 3. Add the Alibaba Cloud mirror for Docker CE:

yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

4. Refresh the yum cache: yum makecache fast 5. Install Docker CE, its CLI, and containerd:

yum install docker-ce docker-ce-cli containerd.io

During installation, confirm prompts by entering y.

6. Verify the installation: docker version 7. Pull and run the hello‑world test image:

docker run hello-world

If the daemon is not reachable, restart the service: sudo service docker restart Then repeat the hello‑world command.

8. List all local images:

docker images

Uninstalling Docker

1. Remove Docker packages:

yum remove docker-ce docker-ce-cli containerd.io

2. Delete Docker’s default data directory: rm -rf /var/lib/docker The directory /var/lib/docker holds Docker’s runtime files.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DockerLinuxcontainerInstallationyumCentOS 7
The Dominant Programmer
Written by

The Dominant Programmer

Resources and tutorials for programmers' advanced learning journey. Advanced tracks in Java, Python, and C#. Blog: https://blog.csdn.net/badao_liumang_qizhi

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.