Docker is an open source platform that lets you create and run ap­pli­ca­tions in so-called con­tain­ers. Con­tain­ers are isolated en­vi­ron­ments that contain all the necessary de­pen­den­cies of an ap­pli­ca­tion. Since Linux-based operating systems like CentOS are very popular de­vel­op­ment platforms, this system fits very well with Docker. We’ll show you how to quickly and easily get Docker installed and running on your CentOS 7 system.

System re­quire­ments

Docker is standard software and doesn’t demand high hardware re­quire­ments. Nev­er­the­less, its software re­quire­ments are somewhat specific. To ensure clarity, we’ve compiled a list of all the system re­quire­ments for you:

  • 64-bit CPU that supports vir­tu­al­iza­tion
  • 4 GB of RAM
  • Gnome, KDE or MATE as desktop en­vi­ron­ment
  • Support for KVM vir­tu­al­iza­tion
  • QEMU (at least version 5.2)
  • System

The right server

Depending on your ap­pli­ca­tion, it might be more optimal to run Docker on a server rather than on your local machine. Various types of servers are suitable for different ap­pli­ca­tion scenarios.

With vir­tu­al­ized servers like the cloud server or the VPS (Virtual Private Server) from IONOS you benefit from scalable resources at any time. This means you won’t need to manage any overhead when acquiring a server – your server will con­sis­tent­ly have precisely the required resources available. The two server types vary in terms of billing. Cloud servers provide minute billing, while VPS servers are billed at a monthly fixed price.

If a vir­tu­al­ized server is not suf­fi­cient for your purposes, IONOS also offers a dedicated server, where resources are reserved around the clock. To achieve this, dedicated servers are powered by cutting-edge en­ter­prise-grade hardware, guar­an­tee­ing your ap­pli­ca­tion always benefits from peak per­for­mance. Similar to the cloud server, dedicated server billing is also done on a minute-by-minute basis.

Ap­pli­ca­tion Matching Server Type
Server for de­vel­op­ing your ap­pli­ca­tion; you only pay for the time you actually use the server for testing the ap­pli­ca­tion Cloud Server XL
Server for de­vel­op­ing or deploying an ap­pli­ca­tion that requires con­tin­u­ous or frequent online avail­abil­i­ty VPS Linux XL
For deploying resource-intensive ap­pli­ca­tions that demand top-tier security and per­for­mance, opt for an en­ter­prise-level server. This ensures your ap­pli­ca­tion con­sis­tent­ly operates on secure and high-per­for­mance hardware without sharing resources Dedicated Server

In­stal­la­tion using yum

On Linux, like on most other systems, there are multiple methods for in­stalling software. In­stalling through a package manager is often the simplest approach. CentOS, for instance, uses yum as its default package manager. To install Docker using yum, you just need to follow a few steps.

Step 1: Update yum and all packages

First you should update your package manager, your installed packages and your Linux core. To do this, enter the following command in your shell:

sudo yum update
bash
Image: Display after yum update
Terminal display after yum update

If you’ve already used Docker on your system, you should remove all Docker com­po­nents before in­stal­la­tion. To do this, enter the following command. If you’ve never had Docker installed on your system, you can skip this step.

sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine
bash

Step 2: Install de­pen­den­cies

Depending on the frequency of your software updates, the process may take a few minutes. Once the update is finished, you should execute the following command to install the necessary de­pen­den­cies for Docker:

sudo yum install -y yum-utils device-mapper-persistent-data lvm2
bash
Image: Display after dependencies have been installed
Terminal display after de­pen­den­cies have been installed

Step 3: Add Docker repos­i­to­ry

Now you need to add the Docker repos­i­to­ry to your package manager. To do this, enter the following command:

sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
bash
Image: Display once repository has been added
Terminal display after --add-repo
Note

The above command adds the Docker Community Edition (CE) repos­i­to­ry to your package manager. To install Docker En­ter­prise Edition (EE), you should replace the above URL with the URL of your Docker EE license.

Step 4: Install Docker

Now it’s time to install Docker on your CentOS system. To complete the in­stal­la­tion process, use this command:

sudo yum install docker-ce
bash
Image: Display after installing Docker on CentOS
Terminal display after install docker-ce
Tip

Besides docker-ce (formerly known as Docker Engine), other essential Docker com­po­nents like Docker Compose, con­tain­erd, and the Docker CE CLI version are often included. If you wish to install these com­po­nents alongside, please use the following shell command instead of the previous one: sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

You can now test if the in­stal­la­tion was suc­cess­ful using the following commands:

sudo systemctl start docker
sudo docker run hello-world
bash
Image: Check Docker installation on CentOS
Terminal display after Docker in­stal­la­tion

Manual in­stal­la­tion

If you’re unable or prefer not to use the Docker repos­i­to­ry, you have the option to manually install the Docker package. Keep in mind that with this method, your Docker in­stal­la­tion won’t receive automatic updates, and you’ll need to manage updates manually. Before pro­ceed­ing with the manual in­stal­la­tion, please make sure to complete steps 1 and 2 from the in­struc­tions mentioned earlier.

Step 1: Download Docker

First, go to the Docker website and select the version you need. We suggest choosing the latest version that begins with docker-ce (not the cli or rootless versions). Make sure to remember the location where you save this .rpm file.

Step 2: Install package

In your shell, run the following command, replacing /package.rpm with the path to the Docker package you down­loaded.

sudo yum install /paket.rpm
bash
Image: Check manual Docker installation on CentOS
Terminal display after manual Docker in­stal­la­tion has been checked
Tip

The vir­tu­al­iza­tion software Docker is not only available for CentOS, but many other operating systems. Find out how to install Docker on Ubuntu 20.04, set up Docker on Debian 11 or Docker on Windows 11.

Go to Main Menu