How to Install Docker on CentOS 7 / RHEL 7

This post will help you with How to Install Docker on CentOS 7 / RHEL 7 with step by step procedure. End of this post, you will be able to understand how to install docker on Linux.


How to Install Docker on CentOS 7 / RHEL 7


Lets get started.

Also Watch this "Docker Installation and Docker CLI Usages" Tutorial video demo on our YouTube Channel.

1. How to enable repository for docker?

On CentOS 7:

Docker packages are available in Centos 'Extras' repository itself. Make sure that this extras repository is enabled or not.

[root@docker-server ~]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.steadfast.net
* extras: centos.eecs.wsu.edu
* updates: mirror.compevo.com
repo id                                            repo name                                                                   status
base/7/x86_64                                      CentOS-7 - Base                                                               9,591
extras/7/x86_64                                    CentOS-7 - Extras                                                               448
media                                              CentOS 7.2 - 64 Bit DVD                                                       3,723
updates/7/x86_64                                   CentOS-7 - Updates                                                              731

If it is not enabled, change "enabled=0" to "enabled=1" in the /etc/yum.repos.d/CentOS-Base.repo. It must looks like below content on extras section.

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

On RHEL 7:

subscription-manager repos --enable=rhel-7-server-rpms
subscription-manager repos --enable=rhel-7-server-extras-rpms
subscription-manager repos --enable=rhel-7-server-optional-rpms

Once you have enabled the required repositories, lets start the docker installation.

2. How to Install Docker using Yum command?

Use "yum" command to install docker with required dependencies automatically.

[root@docker-server ~] yum -y install docker

3. How to Start and Enable the Docker service?

[root@docker-server ~] systemctl start docker
[root@docker-server ~] systemctl enable docker

4. How to Verify Docker information?

Use below docker command with "-v" option to know the docker package version with build release information.

[root@docker-server ~]# docker -v
Docker version 1.13.1, build 774336d/1.13.1

Also use "version" argument along with docker command to know the relevant information about the docker package.

[root@docker-server ~]# docker version
Client:
Version:         1.13.1
API version:     1.26
Package version: <unknown>
Go version:      go1.8.3
Git commit:      774336d/1.13.1
Built:           Wed Mar  7 17:06:16 2018
OS/Arch:         linux/amd64
Server:
Version:         1.13.1
API version:     1.26 (minimum version 1.12)
Package version: <unknown>
Go version:      go1.8.3
Git commit:      774336d/1.13.1
Built:           Wed Mar  7 17:06:16 2018
OS/Arch:         linux/amd64
Experimental:    false

That's all about the Installation of Docker on Linux servers, Its pretty straight forward. Going forward, we will play more with docker tool.
Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.

Post a Comment

0 Comments