Saturday, July 27, 2024
FeaturedSysAdmin

How To Install Docker on Ubuntu Using Repository + Tutorial Video

Hi sobat Kekasi, now i will sharing a tutorial about How To Install Docker on Ubuntu. There is 2 ways to install Docker on Ubuntu, first is by repository and package file .deb. The most easy and simple way is to install Docker on Ubuntu using repository because it will adjust into the Ubuntu version that installed on the laptop or the PC.

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

So let’s get it started How To Install Docker on Ubuntu for all version.

How To Install Docker on Ubuntu Using Repository

The first step, sobat Kekasi need to update the Ubuntu package. Type command:

[root@localhost ~]# sudo apt-get update

Next, install some package you need. Type command:

[root@localhost ~]# sudo apt-get install ca-certificates curl gnupg lsb-release

After that, add Docker’s official GPG key. Type command:

[root@localhost ~]#  curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Then, set up stable repository. Type command:

[root@localhost ~]#  echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

After sobat Kekasi succeded in adding stable repository Docker, sobat Kekasi can install Docker Engine. If sobat Kekasi want to install the newest version of Docker Engine, type command:

[root@localhost ~]# sudo apt-get update
[root@localhost ~]# sudo apt-get install docker-ce docker-ce-cli containerd.io

But if sobat Kekasi want to install the certain version of Docker Engine, type command:

[root@localhost ~]#  apt-cache madison docker-ce
....

  docker-ce | 5:18.09.1~3-0~ubuntu-xenial | https://download.docker.com/linux/ubuntu  xenial/stable amd64 Packages
  docker-ce | 5:18.09.0~3-0~ubuntu-xenial | https://download.docker.com/linux/ubuntu  xenial/stable amd64 Packages
  docker-ce | 18.06.1~ce~3-0~ubuntu       | https://download.docker.com/linux/ubuntu  xenial/stable amd64 Packages
  docker-ce | 18.06.0~ce~3-0~ubuntu       | https://download.docker.com/linux/ubuntu  xenial/stable amd64 Packages
...

Type command: sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io

For example. we will install Docker engine version 18.09.1 so the order code sobat Kekasi need to use is:

[root@localhost ~]#  sudo apt-get install docker-ce= 18.09.1 docker-ce-cli= 18.09.1  containerd.io 

Verify that the device was properly installed to run an image hello-world. Type command:

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

Congratulation, you have successfully installed Docker on Ubuntu using repository. It is very simple and easy to install Docker using repository

Uninstall Docker Engine

  • Uninstall Docker Engine, CLI, and Containers packages:
[root@localhost ~]#  sudo apt-get purge docker-ce docker-ce-cli containerd.io
  • Images, containers, volumes, or special configuration file on your host is 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 Video

Watch on YouTube

Leave a Reply