Docker is a popular software package that creates and manages containers for application development.

Docker creates a uniform interface so that almost any application running on it is compatible with most operating systems. Developing in Docker also speeds up applications, since it shares the kernel and other Linux resources.

This will be a guide on How To install Docker on CentOS 7.


  • A maintained/supported version of CentOS (Docker doesn’t test or support outdated versions)
  • A user account with sudo privileges
  • Internet access
  • Terminal access (Right-click desktop, click Open in Terminal)
  • CentOS Extras repository – this is enabled by default, but if yours has been disabled you’ll need to re-enable it


  • Software package installer yum
  • Docker software repositories

Preliminary Step 1: Uninstall Old Docker Versions

In a terminal window, type the following commands:

sudo yum remove docker \

docker-client \

docker-client-latest \

docker-common \

docker-latest \

docker-latest-logrotate \

docker-logrotate \

docker-selinux \

docker-engine-selinux \


These commands uninstall any outdated versions of Docker on your system. If no previous version was installed, the yum command will inform you. Proceed to update the repositories.

Preliminary Step 2: Update the Repositories

In a terminal window, type:

sudo yum check-update

Allow the operation to complete.

Option A: Install Latest CentOS 7 Version from Docker Repositories

Installing from Docker repositories is the easiest and most popular method of installing or upgrading Docker.

Step 1: Install the dependencies

In a terminal window, type:

sudo yum install -y yum-utils device-mapper-persistent-data lvm2

The –y switch indicates to the yum installer to answer “yes” to any prompts that may come up.  The yum-utils switch adds the yum-config-manager. Docker uses a device mapper storage driver, and the device-mapper-persistent-data and lvm2 packages are required for it to run correctly.

Step 2: Add the Docker repository

In the terminal window, type:

sudo yum-config-manager --add-repo

This command will add the Docker CE stable repository.  You’ll need this repository, even if you want to install the edge or test versions of Docker.  A stable release is tested more thoroughly and has a slower update cycle.  Edge release updates are more frequent but are not subjected to as many stability tests.

Optional Step: Add the Edge and Test repositories

If you want to install the Edge release for more frequent feature updates, type the following in your terminal window:

sudo yum-config-manager --enable docker-ce-edge

Wait for the operation to complete.  If you’d like to install the test repository as well, type the same command and substitute ‘test’ for ‘edge.’


If you’re only going to use the stable release, don’t enable these extra repositories. The Docker installation process will default to the latest version of Docker unless you specify otherwise. Leaving only the stable repository enabled makes sure that you aren’t accidentally updating from a stable release to an edge release.

Step 3: Install Docker On CentOS

In a terminal window, type:

sudo yum install docker-ce

The system should begin the installation.

It is possible that your operating system will ask you to accept the GPG key, which is like a digital fingerprint, so you know whether to trust the installation. The fingerprint should match the following format:

060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35

Step 4: Installing a Specific Version of Docker

If you know that there is a specific release that you need, or you want to choose which version you want to install, start by listing the available versions.  Type the following in your terminal window:

yum list docker-ce --showduplicates | sort –r

The system should give you a list of different versions from the repositories you have enabled above.  Install the version you want by entering:

sudo yum install docker-ce-<VERSION STRING>

The <VERSION STRING> is found in the middle column and is the first part of the alphanumeric code before the hyphen.


The middle column should look something like 18.03.0.ce-1.el7.centos. The first part, 18.03.0.ce is the Docker version. The second part, -1.el7.centos, indicates the build is for your version of CentOS.

Step 5: Manage the Docker Service

You have installed Docker, but the service is not running.  You can start the service, enable it to run at startup, or check the status of the service by running the following commands (respectively):

sudo systemctl start docker

sudo systemctl enable docker

sudo systemctl status docker

Alternative Option: Downloading and Installing from an .rpm File

Step 1: Download the .rpm File

Sometimes, you can’t enable or access the software repositories to install Docker.  In that case, you can download the software package first, then install it.

In a web browser, navigate to Download the .rpm file for the version of Docker you want to install.  Make a note of the location where you save the file.

If you would rather install an edge release, just substitute the word ‘edge’instead of ‘stable’in the URL.

Step 2: Install Docker from the .rpm

In a terminal window, run the following command:

sudo yum install /path/to/package.rpm

Type the path where you saved the file, in place of /path/to/package.rpm.

Step 3: Manage the Docker Service

Just like when installing Docker from repositories, the daemon is now installed, but not running.  You can start the service, enable it at startup, or check the status (respectively) with the following commands:

sudo systemctl start docker

sudo systemctl enable docker

sudo systemctl status docker


Docker installation on CentOS 7 is a bit easier than installing on Ubuntu.

Many of the repositories and dependencies are already configured by default.  Once you’ve got it installed, you should be ready to start playing with Docker containers – happy coding!