Docker Installation process

There could be hundreds of blogs where docker installation process might have been explained and this is just another blog entry that my friends can refer to the process of Docker installation.

I have used Ubuntu v18 Distro and will use to install latest version of Docker.

Followed link: https://docs.docker.com/engine/install/ubuntu/

I am using root user to perform this installation and will not use “sudo” infront of the commands as seen in the documentation.

Step 1:Uninstall old versions of Docker

apt-get remove docker docker-engine docker.io containerd runc

The contents of /var/lib/docker/, including images, containers, volumes, and networks, are preserved after running this command.

A point to note here, Docker Engine on Ubuntu supports overlay2, aufs and btrfs storage drivers. Docker Engine uses the overlay2 storage driver by default.

Docker installation steps

Step 2: Installation methods – Install using the repository

As mentioned in the Documentation link, we can install Docker Engine in different ways, depending on your needs:


1. Most users set up Docker’s repositories and install from them, for ease of installation and upgrade tasks. This is the recommended approach.


2. Some users download the DEB package and install it manually and manage upgrades completely manually. This is useful in situations such as installing Docker on air-gapped systems with no access to the internet.

3. In testing and development environments, some users choose to use automated convenience scripts to install Docker.

I will be using first option, “Install using the repository” given above to perform the installation.

Before you install Docker Engine for the first time on a new host machine, you need to set up the Docker repository. Afterwards, we can install and update Docker from the repository.

Step 3: Set up the repository

Using below commands update the apt package index and install packages to allow apt to use a repository over HTTPS

apt-get update

apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg
Docker installation steps

Docker’s official GPG key will be added in this step

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

Add stable repository

echo \
  "deb [arch=amd64 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
Docker installation steps

Step 4: Install Docker Engine

Update the apt package index, and install the latest version of Docker Engine and containerd. This is the step that takes care of the Installation process. containerd is the container runtime.

apt-get update

apt-get install docker-ce docker-ce-cli containerd.io
Docker installation steps
Docker installation steps

This step completes the installation of Docker. Verify that Docker Engine is installed correctly by running the hello-world image.

docker run hello-world

This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.

Docker installation steps

Checkout the docker version,

Docker installation steps

Commands to check the docker image that ran earlier and container.

docker image ls

docker container ps -a
Docker installation steps

To install a specific version of Docker Engine, list the available versions in the repo, then specify the version name and install:

List the versions available in your repo:

 apt-cache madison docker-ce

Install a specific version using the version string from the second column, for example, 5:18.09.1~3-0~ubuntu-xenial

apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io

Refer to the screenshot that showed up the versions available for installation.

Docker installation steps

Follow Documentation link to perform Post Installation Steps.

This completes the process of Docker installation on Ubuntu.

Leave a Reply

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