You are currently viewing How to install docker on CentOS 7

How to install docker on CentOS 7

Docker

Docker is a set of platform-as-a-service products that use OS-level virtualization to deliver software in containers. The service is available in both free and premium tiers. Docker Engine is the software that runs the containers. Docker, Inc. founded it in 2013 and continues to develop it today.

Prerequisites

  • A version of CentOS that is maintained and supported (Docker does not test or support previous versions).
  • A user account with sudo permissions.
  • Terminal/SSH Access.
  • 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

Installing Docker on CentOS 7 With Yum

The yum command is used to install from Docker repositories, which is the simplest and most popular technique.

 

Step 1: Update Docker Package Database

In a terminal window, type:

sudo yum check-update

Allow the operation to complete.

Step 2: Install the Dependencies

The next step is to download the dependencies required for installing Docker.

Type in the following command:

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

Step 3: Add the Docker Repository to CentOS

To install the edge or test versions of Docker, you need to add the Docker CE stable repository to your system. To do so, run the command:

sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

Step 4: Install Docker On CentOS Using Yum

With everything set, you can finally move on to installing Docker on CentOS 7 by running:

sudo yum install docker

Step: 5 Manage Docker Service

Although you have installed Docker on CentOS, the service is still not running.

To start the service, enable it to run at startup. Run the following commands in the order listed below.

Start Docker:

sudo systemctl start docker

Enable Docker:

sudo systemctl enable docker

Check the status of the service with:

sudo systemctl status docker

 

 

Install a Specific Version of Docker on CentOS

To install a specific version of Docker, start by listing the available releases.

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 selected Docker version with the command:

sudo yum install docker-ce-<VERSION STRING>

 

Testing Docker installation on CentOS 7

After follwoing this guide you must have successfully installed Docker on your System, But one last step is checking the installation to make sure that everything is fine.

To test your installation you need to run this command in your terminal window:

sudo docker run hello-world

You’ll see that there is a message that saying hello from Docker! As stated on the image below: –

 

Conclusion

If you followed this guide, you should have successfully installed Docker on your CentOS 7 machine. Now you can explore the wonderful world of Docker.

Leave a Reply