Docker is an open platform for creating containers developing, shipping & running software applications.

Note:- To install docker on ubuntu 18.04, you need ubuntu 18.04 with 64-bit system.

Step 1 : Uninstall older version if installed already

Docker or docker-engine are the older versions of dockers. If any of these versions are installed in the system, let uninstall them first.

Note:- The docker community package (docker-ce) is now called as docker-ce. docker-ce means docker community edition.

Enter below command on your ubuntu terminal in order to uninstall any older version of docker.



$ sudo apt-get remove docker docker-engine docker.io

Step 2 : Setting up repository for the docker

For updating the ubuntu package. Please run below command


$ sudo apt-get update

Run below command which is used to installing curl and allow apt to use a repository over https


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

Now add the docker GPG key for the official docker repository in your system using the below command


$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Verify added key to the system.

Please run below command in terminal for searching the last 8 characters of the fingerprint in order to verify that now we have key with the finger print 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88.


$ sudo apt-key fingerprint 0EBFCD88

Add into apt repository


$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

Step 3 : Install docker-ce to the system

first update the apt package


$ sudo apt-get update

To install the latest version of docker please run


$ sudo apt-get install docker-ce

It will install docker and will start the docker daemon automatically.

Now docker install is complete and we should have docker running on our system.

Step 4 : check if docker running on system

We have installed the docker in our system, now check what is the status of docker using the below command


$ sudo systemctl status docker

Step 5 : check docker version

Check docker version and detailed info about docker using the below commands


$ sudo docker --version

$ sudo docker version

$ sudo docker info

Step 6 : Stop and start docker

As we have installed docker and it should start automatically but in some case we require to stop and start the docker. below are commands for this purpose.

Command for stopping the docker


$ sudo systemctl stop docker

Command for starting the docker


$ sudo systemctl start docker

Step 7 : How to uninstall docker-ce

First run the command on terminal


$ sudo apt-get purge docker-ce

Then run


$ sudo rm -rf /var/lib/docker

Which will delete all images, containers and volumes or configuration of the docker from the system.

Previous post
How to Install Docker on Ubuntu 16.04
Next post
How to enable and disable the firewall on Ubuntu

Write a Comment

Your email address will not be published. Required fields are marked *

All Rights Reserved. ReadAndCare