How to Install Docker on CentOS 7

r00t July 28, 2017

Install Docker on CentOS 7

In this tutorial we’ll learn how to install Docker on CentOS 7. We will also install and configure its prerequisites. Docker is a container virtualization technology that has gained widespread popularity in recent times, it offers a more efficient way to deploy the application. With Docker, the applications reside inside the container on top of the Linux operating system. Docker uses Kernel features such as cgroups and namespace to allow an independent container to run on single os instance.

I recommend to use a minimal CentOS server setup as a basis for the tutorial, that can be a virtual or a root server image with an CentOS 7 minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.

Install Docker on CentOS 7

Step 1. First, ensure your system is fully up-to-date by running the following:

yum -y update

Step 2. Installing Docker.

Adding the Docker repository:

nano /etc/yum.repos.d/docker.repo

In this file, copy the following content:

name=Docker Repository

After adding the Docker repository we can install docker with the following command:

yum install docker-engine

Start Docker service using the following command as per your operating systems. Also, enable Docker service to auto start on system boot:

systemctl enable docker.service
systemctl start docker.service

Step 3. Deploying your first Docker image, “Hello World!”.

You can use the handy hello-world test to verify whether or not Docker will run on your system:

docker run hello-world

You will get the following output:

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world

4274566986f6: Pull complete
a3ede3fveb02: Pull complete
Digest: sha256:4f32210e234b4ad5cac92BMWE46476c754f13d517e1ada048e5a8ba
Status: Downloaded newer image for hello-world:latest

Hello from Docker.
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker Hub account:

For more examples and ideas, visit:

Congratulation’s! You have successfully configured Docker on your CentOS 7 server.


The Tags:

Leave a Comment

Comments are closed.