X

How To Install Docker Community Edition On Centos 7

Docker is the latest OS-level virtualization system. Docker is a very easy tool designed to make applications using containers. So now I want to share how to install docker ce (Community Edition) on you centos 7 server.  Some info for you What is Docker and why it is used?  and  What is the purpose of a docker?

How To Upgrade Zabbix Server From 3.2.6 To 3.4.1
How To Install Grafana Server On Ubuntu 16.04 Server

My Centos 7 server details

  • OS Type : Centos 7
  • DISK : 50GB
  • RAM : 2GB
  • vCPU : 2

Step #01 : Check your server like os version, disk space and memory using below command.

For server os version check.

[root@Docker-Server ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)

Disk space check using below command.

[root@Docker-Server ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   47G  981M   47G   3% /
devtmpfs                 482M     0  482M   0% /dev
tmpfs                    494M     0  494M   0% /dev/shm
tmpfs                    494M  6.8M  487M   2% /run
tmpfs                    494M     0  494M   0% /sys/fs/cgroup
/dev/xvda1              1014M  130M  885M  13% /boot
tmpfs                     99M     0   99M   0% /run/user/0

Memory check using this command.

[root@Docker-Server ~]# free -h
              total        used        free      shared  buff/cache   available
Mem:           986M        104M        757M        6.7M        123M        733M
Swap:          2.0G          0B        2.0G

Step #02: Now update & upgrade your centos 7 server.

[root@Docker-Server ~]# yum check-update
[root@Docker-Server ~]# yum update -y
[root@Docker-Server ~]# yum install epel-release -y
[root@Docker-Server ~]# reboot

Step #03: Install docker ce using below command for centos 7 server

[root@Docker-Server ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
[root@Docker-Server ~]# yum-config-manager  --add-repo https://download.docker.com/linux/centos/docker-ce.repo
[root@Docker-Server ~]# yum install docker-ce docker-ce-cli containerd.io -y

Show docker-ce list using this command.

[root@Docker-Server ~]# yum list docker-ce --showduplicates | sort -r
 * updates: mirrors.piconets.webwerks.in
Loading mirror speeds from cached hostfile
Loaded plugins: fastestmirror
Installed Packages
 * extras: mirrors.piconets.webwerks.in
 * epel: mirrors.piconets.webwerks.in
docker-ce.x86_64            3:19.03.8-3.el7                    docker-ce-stable
docker-ce.x86_64            3:19.03.8-3.el7                    @docker-ce-stable
docker-ce.x86_64            3:19.03.7-3.el7                    docker-ce-stable
docker-ce.x86_64            3:19.03.6-3.el7                    docker-ce-stable
docker-ce.x86_64            3:19.03.5-3.el7                    docker-ce-stable
docker-ce.x86_64            3:19.03.4-3.el7                    docker-ce-stable
docker-ce.x86_64            3:19.03.3-3.el7                    docker-ce-stable
docker-ce.x86_64            3:19.03.2-3.el7                    docker-ce-stable
docker-ce.x86_64            3:19.03.1-3.el7                    docker-ce-stable
docker-ce.x86_64            3:19.03.0-3.el7                    docker-ce-stable
docker-ce.x86_64            3:18.09.9-3.el7                    docker-ce-stable
docker-ce.x86_64            3:18.09.8-3.el7                    docker-ce-stable
docker-ce.x86_64            3:18.09.7-3.el7                    docker-ce-stable
docker-ce.x86_64            3:18.09.6-3.el7                    docker-ce-stable
docker-ce.x86_64            3:18.09.5-3.el7                    docker-ce-stable
docker-ce.x86_64            3:18.09.4-3.el7                    docker-ce-stable
docker-ce.x86_64            3:18.09.3-3.el7                    docker-ce-stable
docker-ce.x86_64            3:18.09.2-3.el7                    docker-ce-stable
docker-ce.x86_64            3:18.09.1-3.el7                    docker-ce-stable
docker-ce.x86_64            3:18.09.0-3.el7                    docker-ce-stable
docker-ce.x86_64            18.06.3.ce-3.el7                   docker-ce-stable
docker-ce.x86_64            18.06.2.ce-3.el7                   docker-ce-stable
docker-ce.x86_64            18.06.1.ce-3.el7                   docker-ce-stable
docker-ce.x86_64            18.06.0.ce-3.el7                   docker-ce-stable
docker-ce.x86_64            18.03.1.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            18.03.0.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            17.12.1.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            17.12.0.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            17.09.1.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            17.09.0.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            17.06.2.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            17.06.1.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            17.06.0.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            17.03.3.ce-1.el7                   docker-ce-stable
docker-ce.x86_64            17.03.2.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            17.03.1.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            17.03.0.ce-1.el7.centos            docker-ce-stable
 * base: mirrors.piconets.webwerks.in
Available Packages

Restart docker service

[root@Docker-Server ~]# systemctl start docker
[root@Docker-Server ~]# systemctl status docker
[root@Docker-Server ~]# systemctl enable docker
[root@Docker-Server ~]# chkconfig docker on

Check how many docker process run.

[root@Docker-Server ~]# docker ps --all
[root@Docker-Server ~]# docker image ls
[root@Docker-Server ~]# usermod -aG docker root

Search centos docker

[root@Docker-Server ~]# docker search centos
NAME                               DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
centos                             The official build of CentOS.                   5925                                    [OK]
ansible/centos7-ansible            Ansible on Centos7                              128                                     [OK]
jdeathe/centos-ssh                 OpenSSH / Supervisor / EPEL/IUS/SCL Repos - …   114                                     [OK]
consol/centos-xfce-vnc             Centos container with "headless" VNC session…   113                                     [OK]
centos/mysql-57-centos7            MySQL 5.7 SQL database server                   74
imagine10255/centos6-lnmp-php56    centos6-lnmp-php56                              58                                      [OK]
tutum/centos                       Simple CentOS docker image with SSH access      45
centos/postgresql-96-centos7       PostgreSQL is an advanced Object-Relational …   43
centos/httpd-24-centos7            Platform for running Apache httpd 2.4 or bui…   31
kinogmt/centos-ssh                 CentOS with SSH                                 29                                      [OK]
pivotaldata/centos-gpdb-dev        CentOS image for GPDB development. Tag names…   11
guyton/centos6                     From official centos6 container with full up…   10                                      [OK]
centos/tools                       Docker image that has systems administration…   6                                       [OK]
drecom/centos-ruby                 centos ruby                                     6                                       [OK]
pivotaldata/centos                 Base centos, freshened up a little with a Do…   4
mamohr/centos-java                 Oracle Java 8 Docker image based on Centos 7    3                                       [OK]
darksheer/centos                   Base Centos Image -- Updated hourly             3                                       [OK]
pivotaldata/centos-gcc-toolchain   CentOS with a toolchain, but unaffiliated wi…   3
pivotaldata/centos-mingw           Using the mingw toolchain to cross-compile t…   3
miko2u/centos6                     CentOS6 日本語環境                                   2                                   [OK]
indigo/centos-maven                Vanilla CentOS 7 with Oracle Java Developmen…   1                                       [OK]
blacklabelops/centos               CentOS Base Image! Built and Updates Daily!     1                                       [OK]
pivotaldata/centos6.8-dev          CentosOS 6.8 image for GPDB development         0
pivotaldata/centos7-dev            CentosOS 7 image for GPDB development           0
smartentry/centos                  centos with smartentry                          0                                       [OK]

Same as like Search ubuntu docker

Step #04: Now create docker centos using below command.

[root@Docker-Server ~]# docker pull centos

Wait 2-3 minute then see created done. Now check using command.

[root@Docker-Server ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
centos              latest              470671670cac        2 months ago        237MB

Login into created docker centos

[root@Docker-Server ~]# docker run -it centos
[root@836f2909f2a8 /]#

Exit from docker

[root@836f2909f2a8 /]# exit

Start or stop docker container using below command.

[root@Docker-Server ~]# docker start 836f2909f2a8
[root@Docker-Server ~]# docker stop 836f2909f2a8

This is container id : 836f2909f2a8

If see any problem so please see my YouTube video for more details. Don’t forget share this tutorial to your friends or social media network.

0 0 votes
Article Rating
Admin: I am system administrator as Windows and Linux platform. I have 4 years skilled from the professional period. I have to configure Linux based system such as an Asterisk VOIP system, Network monitoring tools (ZABBIX), Virtualization (XEN Server), Cloud computing (Apache CloudStack) etc. Now share my professional skill each interested person. Thanks to all.
Leave a Comment