habibzain Just husband, father and enthusiastic men about System Administration. Love to write short article about it. Perhaps can help and be useful for others.

Easy Install Docker on Ubuntu 20.04

1 min read

On this post today, i will write about an easy way to install docker on ubuntu 20.04. Docker is an application that simplifies the process of managing application processes in containers. Containers let you run your applications in resource-isolated processes.

Reference: https://docs.docker.com/engine/install/ubuntu/

Prerequisites

OS requirements to install Docker Engine, you need the 64-bit version of one of these Ubuntu versions:

  • Hirsute 21.04
  • Focal 20.04 (LTS)
  • Bionic 18.04 (LTS)

Docker Engine is supported on x86_64 (or amd64), armhf, arm64, and s390x architectures.

Uninstall old versions

Older versions of Docker were called docker, docker.io, or docker-engine. If these are installed, uninstall them:

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

It’s OK if apt-get reports that none of these packages are installed.

Install using the repository

Install Docker Engine for the first time on a new host, we need to set up the Docker repository on ubuntu server.

In this post, we will install and update Docker from the repository.

Set up the repository

  1. Update the apt package index and install packages to allow apt to use a repository over HTTPS:
 $ sudo apt-get update
 $ sudo apt-get install apt-transport-https 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. Follow the command below to set up the stable repository. 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
Show source list Docker repository.

Install Docker Engine

  1. Update the apt package index, and install the latest version of Docker Engine and containerd, 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

After installaton finished, let make sure service container docker is running well.

sudo systemctl status docker

2. To install a specific version of Docker Engine, please see show list the available versions in the repo result.

See also  Pi-Hole Add adlist from Source Third Party

a. List the versions available in your repo:

$ apt-cache madison docker-ce

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

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

3. Verify that Docker Engine is installed correctly by running the hello-world image.

$ sudo docker run hello-world

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

Yeay, congrats. Finally our docker is running now.

habibzain Just husband, father and enthusiastic men about System Administration. Love to write short article about it. Perhaps can help and be useful for others.

Ansible Ubuntu 20.04

Introduction Ansible is an open-source automation tool that simplifies configuration management, application deployment, and task automation. It is designed to be simple, lightweight, and...
habibzain
1 min read

Leave a Reply

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

Never miss good article from us, get weekly updates in your inbox