Docker is an open platform for developing, build, shipping, running the applications very quickly and bundle our software into standardized units called containers. When you install the docker engine or daemon have to install all the necessary elements which the software needs to run including libraries, system tools, code, and runtime. We are able to easily manage our infrastructure in the same ways you manage your applications. This Post will help you how to install Docker Engine in your machine.

Update your packages in your system,

$ sudo apt-get update

Install depedency packages using the command below,

sudo apt-get install apt-transport-https ca-certificates

0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,512 B of archives.
After this operation, 169 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 jammy/universe amd64 apt-transport-https all 2.4.5 [1,512 B]
Fetched 1,512 B in 0s (14.1 kB/s)               
Selecting previously unselected package apt-transport-https.
(Reading database ... 218389 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_2.4.5_all.deb ...
Unpacking apt-transport-https (2.4.5) ...
Setting up apt-transport-https (2.4.5) ...

Add the GPG key for the official Docker repository to your system,

$ sudo curl -fsSL | sudo apt-key add -


Warning: apt-key is deprecated. Manage keyring files in tru
sted.gpg.d instead (see apt-key(8)).


If you may received an error when you use the curl command for add the repository apt-key in your machine, Install the curl package or refer this link  
sudo: curl: command not found


Install CURL package:
$ apt-get install curl

Add the Docker repository to APT sources using the command below,

$ sudo add-apt-repository "deb [arch=amd64] xenial stable"

Repository: 'deb [arch=amd64] xenial stable'
Archive for codename: xenial components: stable
More info:
Adding repository.
Press [ENTER] to continue or Ctrl-c to cancel.
Hit:8 jammy InRelease
Fetched 87.2 kB in 1s (78.5 kB/s)
Reading package lists... Done
W: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.

Update the system with recently updated repository
$ sudo apt-get update 

Finally execute the command to install the docker community endition in your machine,

$ sudo apt-get install docker-ce

Suggested packages:
  aufs-tools cgroupfs-mount | cgroup-lite
The following NEW packages will be installed: docker-ce docker-ce-cli docker-ce-rootless-extras docker-scan-plugin libslirp0 pigz slirp4netns
0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
Need to get 107 MB of archives.
After this operation, 466 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y

Check the Docker version,

$ docker -v

Docker version 20.10.7, build f0df350

If you may received an eror when access the docker containers,
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json: dial unix /var/run/docker.sock: connect: permission denied

Soltutions are here: