Install Docker on Ubuntu
Install Docker on Ubuntu

Hi Guys, Welcome to Proto Coders Point. In this artcile let’s learn basic about docker & how to install docker ubuntu server – the easiest way.

Before we start, Let under what docker is exactly.

What is docker?

A Docker is a platform basically used for developing, running a application & easily shipping application file. Docker help developer to pack their application into a docker container so that it wil be easily to transfer application to other system. A docker container image include all the required dependencies to execute your code on any machine.

What is docker container?

A Container in docker is executable package of application source code with operating system libraries & the dependencies that required to run code in any envirnoment.

Advanctage of implementing docker

By using docker, it reduce the effort & errors that usually occurs while deploying our code from local to server.

Docker provide rapid delivery & reduce the deployment time as it is very lightweight & minimal overhead.

How to install docker on ubuntu server – AWS

There are various way to install docker on ubuntu like using repository or by using script from

Follow below steps to install docker.

Installing docker using repository

1. Update apt package

sudo apt-get update

install curl, gnupg, lsb-release, ca-certificates

sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \

2. Add docker GPG key

curl -fsSL | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
docker gpg key command

3. Set-Up docker stable repository

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

4. Installing docker Engine

a. Update apt again

sudo apt-get update

b. Install docker on ubuntu

Now install current latest version of docker 20.10.12 & docker cli and

sudo apt-get install docker-ce docker-ce-cli
install docker
install docker cli

c. Check for installed version

Now check if docker was sucessfuly installed by checking docker version

docker --version
docker version check
docker version check

d. Verify if docker working

Now let’s run docker command to execute “hello-world” docker image container.

sudo docker run hello-world

The above command, will search for hello-world in local, if not found then it downloads offical text image of hello-world from docker site & run it in container, when container execute it prints the message helloworld & exit.

docker hello world image
docker hello world image

There we have successfully installed docker in ubuntu server.

How to uninstall docker from ubuntu

1. First Step unistall docker engine, cli and container packages:

sudo apt-get purge docker-ce docker-ce-cli

2. After uninstalling, docker image, container and other docker config on your local host will not automatically get deleted, we need to remove them manually, if we want a freshly uninstall docker. run below rm commands

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