Docker is a containerization platform that allows users to build and manage various types of applications in containers. CentOS 10 is a Linux-based operating system and is utilized as the host operating system for running Docker containers. Docker offers a variety of services and tools to build and deploy applications in containers on these platforms quickly. Moreover, Docker commands are the same for both platforms.
This write-up will illustrate the following:
How to Install Docker on CentOS 10?
To install Docker on CentOS 10, update package databases. Then, add the Docker repository, install Docker, and start Docker services. Let’s start the installation with the easiest method:
Method 1: Using the Official Docker Repository
This is the official and most reliable method, directly maintained by Docker.
Step 1: Install yum-utils
The yum-utils provides yum-config-manager tools that help manage repositories and enable/disable them. Let’s install it:
sudo yum install -y yum-utils |

Step 2: Add the Docker repository
The yum-config-manager command adds Docker’s official repository URL to your system’s repo list:
sudo yum-config-manager \ –add-repo \ https://download.docker.com/linux/centos/docker-ce.repo |

That way, when you install Docker, it comes from Docker’s maintained source, ensuring the latest stable versions.
Step 3: Install Docker Engine
Now, install Docker and all its components on CentOS:
sudo yum install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin |

Here,
- docker-ce: The Docker Engine (Community Edition).
- docker-ce-cli: Command-line interface to manage Docker.
- containerd.io: A container runtime Docker uses under the hood.
- docker-compose-plugin: Enables “docker compose” commands (Compose v2).
Step 4: Start and enable Docker
Launches the Docker service immediately. Also, ensures Docker starts automatically on boot:
sudo systemctl start docker sudo systemctl enable docker |

Step 5: Verify installation
Let’s confirm Docker CLI is installed:
sudo docker –version |

Let’s check the services:
sudo docker run hello-world |

Here, docker run hello-world downloads a small test image and runs it in a container to confirm Docker is working properly.
Method 2: Using Docker’s Convenience Script
Docker offers a one-line installation script that automatically. It detects your OS, adds the repo, installs the correct Docker version. Let’s install it:
Step 1: Update Package Database
First, execute the following command to check for available updates for the installed packages on the system and update them:
sudo yum update |

The output shows that the package list is successfully updated.
Step 2: Add Docker Repository and Download Docker
Then, add the official Docker repository to the system’s package sources and install/download Docker’s latest version. After that, install the Docker engine package through the provided command:
curl -fsSL https://get.docker.com/ | sh |

The above-executed command has downloaded and installed the latest version of Docker.
Step 3: Start Docker Daemon
Next, type out the given command to start the Docker daemon:
sudo systemctl start docker |

This command has started the Docker services.
Let’s enable the services:
sudo systemctl enable docker |

Step 4: Verify the Status of Services
To verify whether the Docker daemon services have been started or not by checking their status:
sudo systemctl status docker |

It can be seen that the Docker Daemon is running.
Step 5: Verification
Finally, run any Docker command to ensure that Docker has been installed successfully and its services are running. For instance, execute the following command:
sudo docker run hello-world |

The output shows that Docker has been successfully installed on CentOS.
How to Use Docker on CentOS?
Docker can be used in different ways on CentOS, such as:
- Pull Image From Docker Hub
- List All Docker Images
- Build and Run Docker Container
- View All Docker Containers
Usage 1: Pull an Image From Docker Hub
To pull a particular Docker image from the Docker hub, utilize the “sudo docker pull <image-name>” command:
sudo docker pull nginx:latest |

According to the above output, the latest version of the “nginx” image has been downloaded successfully.
Usage 2: List All Docker Images
Execute the given command to display all the available Docker images:
sudo docker images |

The above output indicates that there are three Docker images available on the local system.
Usage 3: Build and Run Docker Container
In order to create and execute a Docker container from a particular Docker image, write out the “sudo docker run -d –name <container-name> <image-name>” command:
sudo docker run -d –name nginxCont nginx:latest |
Here:
- The “-d” option is utilized to execute the container in detached mode.
- “–name” defines the container name, i.e., “nginxCont”.
- “nginx:latest” is the latest version of the Docker Hub image to utilize for the container:

This command has built and executed the container.
Usage 4: View All Docker Containers
Type out the following command to display all the Docker containers:
sudo docker ps -a |

In the above output, two Docker containers can be seen.
Conclusion
To install Docker on CentOS 10, first, update the package databases. Then, add Docker Repository and download Docker through the “curl -fsSL https://get.docker.com/ | sh” command. Next, start Docker services via the “sudo systemctl start docker” command and verify its status. The user can use Docker on CentOS to perform various operations, such as pulling an image from Docker Hub, listing all Docker images, building and running Docker containers, viewing all containers, and many more.
Leave feedback about this