Install Docker on Ubuntu 20.04 – Tutorial
Docker is an open-source containerization platform that allows you to quickly build, test, and deploy applications as portable containers that can run virtually anywhere. A container represents a runtime for a single application and includes everything the software needs to run.
Docker is an integral part of modern software development and DevOps continuous integration and deployment pipelines.
This tutorial covers how to install Docker on an Ubuntu 20.04 machine.
Docker is available for installation from the standard Ubuntu 20.04 repositories, but it may not always be the latest version. We’ll install the latest Docker package from the official Docker’s repositories.
Login to your Ubuntu 20.04 system with sudo privileged user. Then run the following commands to install required packages.
sudo apt update sudo apt install curl apt-transport-https ca-certificates software-properties-common
Install Docker on Ubuntu:
First of all, import the GPG key to yoru system to verify packages signature before installing them. To import key run the below command on terminal.
curl-fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add
After that add the Docker repository on your Ubuntu system which contains Docker packages including its dependencies. You must have to enable this repository to install Docker on Ubuntu
sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable”
Your system is now ready for Docker installation. Run the following commands to upgrade apt index and then install Docker community edition on Ubuntu.
sudo apt update sudo apt install docker-ce docker-ce-cli containerd.io
Install Docker Compose
After successful installation of Docker community edition, the service will start automatically, Use below command to verify service status
sudo systemctl status docker
The output will look something like this
docker.service–Docker Application Container Engine
Loaded:loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active:active (running) since Thu 2020-06-29 14:47:34 UTC; 42s ago
Manage Docker Service:
Use below command to stop, start or restart Docker service:
sudo systemctl stop docker
sudo systemctl start docker
sudo systemctl restart docker
Run Docker Hello World
Once you completed the Docker service installation on your Ubuntu system. Run a hello world example to verify everything is fine.
To verify, open a terminal and type
sudo docker run hello-world
Install Docker Compose:
Download the latest version of Docker compose tool from Github. Use the below commands to download and install Docker compose . Before installing make sure compatibility with your docker version
curl -L https://github.com/docker/compose/releases/download/1.26.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose
Mildaintrainings offer you Docker Training course which is designed by Devops Subject Matter Experts to help you understand Docker concepts and perform handson docker operations. Enroll and get Certified Now.