Docker is a most popular, open-source platform for developers and system administrators to build, run, and share applications with containers. Containerization (the use of containers to deploy applications) is becoming popular because containers are flexible, lightweight, portable, loosely coupled, scalable, and more secure.

This article is a good starting point for beginners to learn how to install and use Docker on a Ubuntu 20.04 Linux system with some basic commands. For this guide, we will install Docker Community Edition (CE).

Prerequisites:

Installing Docker on Ubuntu 20.04

To use the latest version of Docker, we will install it from the official Docker repository. So, start by adding the GPG key for the official Docker repository to your system, after that add the repository configuration to the APT source with the following commands.

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"

Now update the APT package cache to include the new Docker packages to the system using the following command.

$ sudo apt update

Next, install the Docker package as shown.

$ sudo apt install docker-ce

Install Docker on Ubuntu

Install Docker on Ubuntu

During the Docker package installation process, the package installer triggers the systemd (system and service manager) to automatically start and enable the docker service. Using the following commands to confirm that the docker service is active and is enabled to automatically start at system startup. Also, check its status:

$ sudo systemctl is-active docker
$ sudo systemctl is-enabled docker
$ sudo systemctl status docker

Check Docker Status

Check Docker Status

There are several other systemctl commands to manage and control the docker service which includes the following:

$ sudo systemctl stop docker			#stop the docker service
$ sudo systemctl start docker			#start the docker service
$ sudo systemctl  restart docker		#restart the docker service

To check the version of Docker CE installed on your system, run the following command:

$ docker version

Check Docker Version

Check Docker Version

You can view available docker usage commands by running the docker command without any options or arguments:


$ docker

List of Docker Commands

List of Docker Commands

#docker #ubuntu #docker tips #ubuntu tips

How to Install and Use Docker on Ubuntu 20.04
3.20 GEEK