How are you doing? You know that for being a DevOps Engineer you have to knowledge about Docker. In this Docker tutorial, I will show you How to install Docker on ubuntu 20.04. Before installing use docker, you’ve to knowledge about what is the purpose of docker and how to use it.
What is Docker and its purpose?
Docker is an open-source containerization platform. It enables developers to package applications into containers—standardized executable components combining application source code with the operating system (OS) libraries and dependencies required to run that code in any environment.
How to install Docker on ubuntu 20.04
Well, now I will show you how to install Docker in your Ubuntu Operating System. It will be a couple of steps, you have to follow those steps and run all commands step by step.
sudo apt-get update
Run this command, So that your all Local repository can Reload. Well, Next run this command. It will Install prerequisite packages for doker
sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-common
Well, now run this command for Add GPG key of Docker
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
check the key by this command
sudo apt-key fingerprint 0EBFCD88
Add docker repository to APT:
sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"
Update apt packages and install docker-engine by this command.
sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io
Well, Our docker has been installed properly. Now You can see the docker version by this command.
docker --version // Docker version 20.10.7, build f0df350 or you may run docker -v // same output
Well, Now have to install Docker Compose. Before install, Docker Compose you have to know what is Compose?
Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration.
Well, Run bellows command step by step
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Set the permission of docker-compose
sudo chmod +x /usr/local/bin/docker-compose
Well, Our docker-compose has been installed successfully. Now you can check this version by this command.
docker-compose --version // docker-compose version 1.27.4, build 40524192
Well, now I will show you how to uninstall docker from your system.
sudo apt-get purge docker-ce docker-ce-cli containerd.io
sudo rm -rf /var/lib/docker
Hope It will help you.