
Docker Intallation on Ubuntu
- 2 minsIntroduction
Docker is an application that is using with containers. With the containers you can create one or more environment than you can run your applications in it. They are similar to virtual machines. Docker has so many feature like volume mapping, docker host, docker network, images and more.
With this article I will try to explain Docker installation on Ubuntu 20.04.3 on CLI (Command Line Interface) let’s say terminal level. Why I choose CLI level because If you will work with a server or minimal operation system which has not GUI you must work with commands and CLI. Other advantage is learn that what is going infrastructure.
Before start If you use Windows you should create a VM with Virtual Box or VMware and than installing Ubuntu.
There are installation methods for Docker, In my opinion follow the Install using the repository installation method is the easiest and most understandable method. If you want to learn other methods you can check the Docker Docks for ubuntu.
Install using the repository
Before you install Docker Engine for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install and update Docker from the repository.
Set up the repository
1-) Update the apt (Advanced Package Tool) and install to required packages.
$ sudo apt-get update
$ sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
2-) Add Docker’s official GPG key:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
3-) Use the following command to set up the stable repository. To add the nightly or test repository, add the word nightly or test (or both) after the word stable in the commands below.
$ echo \
"deb [arch=$(dpkg --print-architecture) 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
Set up the repository
Install Docker Engine
1-) Update the apt package index, and install the latest version of Docker Engine, containerd, and Docker Compose, or go to the next step to install a specific version:
$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
2-) To install a specific version of Docker Engine, list the available versions in the repo, then select and install:
a. List the versions available in your repo:
$ apt-cache madison docker-ce
![docker install-4][8]
As you see list of avaible versions for you repo and next step is installing the spesific versions just select the name of version from second coloumn it should be like that 5:18.09.1~3-0~ubuntu-xenial
$ sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io docker-compose-plugin
3-) Verify that Docker Engine is installed correctly by running the hello-world image.
$ sudo docker run hello-worlddocker-compose-plugin
that is all you installed Docker on your Ubuntu so time to enjoy Docker :)