How to Install Docker on Linux: A Step-By-Step Guide

Install Docker on Linux

If you are new to web development and you want to brush up on your skills by learning docker you are at the right place. In this article, I will share a step-by-step guide on how to install docker on Linux. The article is completely beginner-friendly. I will be using Ubuntu to install docker and demonstrate it to you.

What is Docker?

Docker is a set of the platform as service products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries, and configuration files. All containers are run by a single operating-system kernel and are thus more lightweight than virtual machines.

What is Container?

Docker Container is a standardized unit that can be created on the fly to deploy a particular application or environment. It could be an Ubuntu container, CentOs container, etc. Also, it could be an application-oriented container like a CakePHP container or a Tomcat-Ubuntu container, etc.

How to Install Docker on Ubuntu Linux

For this tutorial I will be using Ubuntu, it doesn’t matter what linux distribution you are using, all you need is a 64-bit installation and a kernel at 3.10 or newer. You can check your current Linux version by typing this command in terminal uname -r. You should see something like 3.10.[alphanumeric string].x86_64. It’s very easy to install docker on Linux all you need is to follow all the steps carefully

1. Open a terminal and type: sudo apt-get update

2. Install cURL by typing the following command in terminal: sudo apt-get install curl

3. Now we will use cURL to get the latest Docker package: curl -fsSL https://get.docker.com/ | sh

4. Now add your account to the docker group type: sudo usermod -aG docker

5. Now enter the following command to verify the Docker installation: docker run hello-world you will see the following result.

$ docker run hello-world
 
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b901d36b6f2f: Pull complete 
0a6ba66e537a: Pull complete 
Digest: sha256:8be990ef2aeb16dbcb9271ddfe2610fa6658d13f6dfb8bc72074cc1ca36966a7
Status: Downloaded newer image for hello-world:latest


Hello from Docker.

This message shows that your installation appears to be working correctly.

Also See: How to Install Docker on Mac

How to Uninstall Docker on Ubuntu Linux

Uninstalling docker is very easy on Linux enter the following command in the terminal and hit enter:

1. Uninstall the Docker Engine, CLI, and Containerd packages:

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

2. Images, containers, volumes, or customized configuration files on your host are not automatically removed. To delete all images, containers, and volumes:

sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd

If you have edited any configuration file you need to delete it manually.

Conclusion

Congratulation, now you have learned how to install docker in Linux this was a simple and beginner-friendly step-by-step guide you can bookmark this page to get the updated information on docker installation in Ubuntu. To do share this article with your friends if you have any further queries do let me know via Twitter at Devenderkg.

Posted by
Devender Gupta

Founder & Editor-in-chief of Gizmoxo - Entrepreneur, Youtuber, Reviewer, Traveler