PopOS

How to Install Docker on Pop!_OS

Docker is a lightweight application that is preferred by many developers to test their applications and is an open-source platform where testing, deployment, and management of applications are done by containerizing them. Docker allows the developers to bind the source code with the dependency files of the operating system in the form of containers that makes the execution of the application really fast. The most popular features of Docker are:

  • Secure
  • Smooth parallel operation of applications
  • Large Docker community (Docker Hub) 

Initially, Docker was designed with the Kernel of Linux but later due to its popularity, its version for Windows has also been released. In this write-up, we will install Docker on Pop!_OS which is the Ubuntu-based distribution of Linux. We will install Docker on Pop!_OS by two methods:

  • Through the official repository
  • From Snapcraft store

Installation of the Docker through the repository in Pop!_OS

For the installation of the Docker through the repository, update the repository first by using the command:

$ sudo apt update

The packages are up to date, as we are installing the Docker first time, we have to set up the repository which we can do by installing the dependencies with the command:

$ sudo apt install  ca-certificates  curl  gnupg  lsb-release

Download the GPG key of the Docker from its website and add it to the repository of Pop!_OS:

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Add the stable repository of the dockers from its website to the repository of Pop!_OS:

$ 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

Update the repository of Pop!_OS once again:

$ sudo apt update

Install the latest version of Dockers on Pop!_OS:

$ sudo apt install docker-ce docker-ce-cli containerd.io -y

After the complete installation of the Docker, we will check its status using the command:

$ sudo systemctl status docker

The docker has been installed successfully as well as it is running.

How to uninstall the docker from Pop!_OS

If you don’t need the Dockers anymore, you can remove it from the Pop!_OS using:

$  sudo apt-get purge docker-ce docker-ce-cli containerd.io -y

Also, remove the directories of Docker and containers by running the commands:

$ sudo rm -rf /var/lib/docker

$ sudo rm -rf /var/lib/containerd

The docker has been removed successfully from the Pop!_OS.

Installation of the Docker from Snapcraft store in Pop!_OS

Snapcraft is also a package manager like APT and YUM through which we can install packages in Pop!_OS. To use the snapcraft, we have to install the snapd which we can by running the command:

$ sudo apt install snapd

After the installation of the snapd, we will install docker using the snap package manager:

$ sudo snap install docker

To confirm the installation, we will check its version by running the command:

$ docker --version

We can uninstall it using the snap package manager:

$ sudo snap remove docker

Conclusion

Docker helps the developers to test, deploy, and manage their application by combining the source code with the dependencies of the operating system on a single platform, it is also supported by all the Linux kernels as well as Windows. In this write-up, the installation procedure of Dockers on Pop!_OS has explained. We have installed it on Pop!_OS by using the official repository as well as from the snapcraft store.

In the repository method, we downloaded its GPG key and stable repository to the repository of Pop!_OS and install it, whereas in the snapcraft method, we downloaded the snap of Docker from the snapcraft store and installed it on Pop!_OS, both methods are convenient to use for the installation of Docker in Pop!_OS.

About the author

Hammad Zahid

I'm an Engineering graduate and my passion for IT has brought me to Linux. Now here I'm learning and sharing my knowledge with the world.