Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production.

Step 1 – Install Prerequisites For Docker

The best practice it whenever you install any things do update and upgrade with the following commands

sudo apt-get update

sudo apt-get upgrade

Step 2 – Installing the Dependencies

Install packages to allow apt to use a repository over HTTPS

sudo apt-get install apt-transport-https ca-certificates curl software-properties-common

Step 3 – Installing Docker CE

Add docker GPG key for docker repository

curl -fsSL | sudo apt-key add -

Add the docker repository in your system

sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"

Install the latest version of Docker CE

sudo apt-get install docker-ce

Step 4 – Executing the Docker Command Without sudo

For this we need to add your user to docker group, So using usermod -aG command we add the user to docker group.

USER is Linux shell environment variables which return your username. 

sudo usermod -aG docker ${USER}

To apply the new group membership

su - ${USER}

To check weather you added to docker group or not. Just execute id -nG command

id -nG

Step 5 – To check weather docker is install or not

Just execute docker command which show you the list of options

“Write once, run everywhere”

— Docker