Monday, October 2, 2023

How To Install Docker on Centos Using Repository + Video


Hi sobat Kekasi, now i will sharing a guideline about How To Install Docker on Centos. There is 2 way to install Docker on Centos, first is by repository and package file .rpm. The most easy and simple way is install Docker on Centos using repository because it will later match up with the centos version , whether it uses centos 7 or centos 8.

In this tutorial, we will install Docker on Centos using repository. For the tutorial video, sobat Kekasi can see it on Youtube channel by Kekasi Gen, or sobat Kekasi can see it at the end of this article.

So let’s get it started, the tutorial about How To Install Docker on Centos 7 or Centos 8

How To Install Docker on Centos Using Repository

First step is sobat Kekasi need to install package yum-utils. Type order:

[root@localhost ~]# sudo yum install -y yum-utils

Next is you need to download and add repository docker. Type command:

[root@localhost ~]# sudo yum-config-manager --add-repo

After sobat Kekasi have successfully added the repository docker, next sobat Kekasi need to install Docker Engine. If sobat Kekasi want to install the newest version of Docker Engine, running order:

[root@localhost ~]# sudo yum install docker-ce docker-ce-cli

But if you want to install certain version of Docker Engine, type command:

[root@localhost ~]#  yum list docker-ce --showduplicates | sort -r
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.15-3.el7                    docker-ce-stable
docker-ce.x86_64            3:19.03.14-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.13-3.el7                    docker-ce-stable

Type command: sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING>

For example, we will iinstall docker engine version 19.03.6 so the command code you need to use is:

[root@localhost ~]#  sudo yum install docker-ce-19.03.6  docker-ce-cli-19.03.6

After the installation process of docker engine are done, sobat Kekasi can running the docker engine by command:

[root@localhost ~]#  sudo systemctl start docker

Verify that the docker engine was properly installed by running image hello-world. Type command:

[root@localhost ~]#  sudo docker run hello-world

Congratulation, you have successfully installed Docker on Centos using repository. It’s very easy and simple to install Docker using repository.

Configure Docker to Start on Boot

Most of current Linux distribution (RHEL, Centos, Fedora, Debian, Ubuntu, 16.04 and higher) uses system to manage which services start when the system starts booting. On Debian and Ubuntu, Docker service configured to start while boot by default. To start docker and container automatically when the boot is for another district, use the command below:

 $ sudo systemctl enable docker.service
 $ sudo systemctl enable containerd.service

To inactive, use disable instead

$ sudo systemctl disable docker.service
$ sudo systemctl disable containerd.service

Uninstall Docker Engine

  • Uninstall DOcker Engine, CLI, and containerd packages:
[root@localhost ~]#  sudo yum remove docker-ce docker-ce-cli
  • Images, containers, volumes, or special configuration file on your host are not automatically removed. To remove all the images, containers, and volumes:
[root@localhost ~]#  sudo rm -rf /var/lib/docker
[root@localhost ~]#  sudo rm -rf /var/lib/containerd

Tutorial Viideo

Watch on YouTube

Leave a Reply