Install Docker on Ubuntu: A Step-by-Step Guide
5 mins read

Install Docker on Ubuntu: A Step-by-Step Guide

Docker, which makes it possible to create and run applications in separate containers, has grown to be a vital tool for system administrators and developers. In order to take advantage of Docker’s features. For enjoying advantage of the Docker we need to install Docker.

Containerization has emerged as a critical technique in the field of modern software development and deployment. Docker is one of the most popular and powerful solutions among the many containerization tools available to DevOps. With Docker, developers can bundle dependencies and programs into containers for consistency across many environments and to streamline deployment procedures. We’ll take you step-by-step through the installation of Docker on Ubuntu, one of the most popular Linux distributions, in this tutorial.

Prerequisites for Install Docker

  • 64-bit kernel and CPU support for virtualization.
  • KVM virtualization support. To check if the KVM kernel modules are enabled and how to access the KVM device to your system. Install KVM to your System
  • Gnome, KDE, or MATE Desktop environment. Docker Desktop environments, gnome-terminal must be installed
  • At least 4 GB of RAM.
  • An Ubuntu system with an active internet connection.
  • Administrative privileges (sudo access) on your Ubuntu system.

Installation Steps:

Checking that your package’s list is updated is always a good practice before installing any new software.

Update Package Lists:

To Updates your package list on Ubuntu, Open a terminal window (Ctrl+Alt+T) and run the following command:

sudo apt update

Install Prerequisite Packages:

Installing some essential software is necessary for Docker. These packages contain additional required tools and enable the use of HTTPS over APT. To add repositories and manage dependencies, a few more packages are needed. Utilizing the following command, install them:

sudo apt install apt-transport-https ca-certificates curl software-properties-common

Add Docker’s GPG Key:

You must add the official GPG key for Docker to your system in order to guarantee the authenticity of its packages. Set up During install Docker uses a GPG key to confirm the legitimacy of packages. Utilizing this command, add the key

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Add Docker Repository

Give the location of the repository for Docker packages. Execute the following command, substituting your particular Ubuntu version for [UBUNTU_VERSION] (for example, focal for Ubuntu )

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu [UBUNTU_VERSION] stable"

Update Package Lists

After adding the new repository, refresh your package lists to reflect the changes

sudo apt update

Install Docker Engine

Finally, install Docker Engine and the command-line interface (CLI) using this command

sudo apt install docker-ce docker-ce-cli containerd.io

Verifying Installation

Once the installation is complete, verify Docker’s functionality by running the following command

docker run hello-world

This should to produce a brief message letting you know that Docker is operational.

Install Docker

Manage Docker as a Non-Root User

If you prefer not to use sudo each time you run Docker commands, you can add your user to the docker group. For add User group run the following command

sudo usermod -aG docker ${USER}

Docker Desktop

The steps for installing, starting, and updating Docker Desktop on an Ubuntu distribution are covered in this section.

Download Docker DEB Package

Prerequisites

  • 64-bit kernel and CPU support for virtualization.
  • KVM virtualization support. To check if the KVM kernel modules are enabled and how to access the KVM device to your system. Install KVM to your System
  • Gnome, KDE, or MATE Desktop environment. Docker Desktop environments, gnome-terminal must be installed
  • At least 4 GB of RAM.
  • For non-Gnome Desktop environments, gnome-terminal must be installed
sudo apt install gnome-terminal

Installation Steps:

To install Docker’s package repository. Install the package with apt as follows:

sudo apt-get update
sudo apt-get install ./docker-desktop--.deb

Launch Docker Desktop

Docker Desktop for Linux may be launched by searching for it in the Applications menu and then selecting it. In addition to displaying the Docker Dashboard and launching the Docker menu icon, this also reports the Docker Desktop’s status.

systemctl --user start docker-desktop

You have successfully installed Docker on your Ubuntu machine by following these steps. You can investigate creating, executing, and maintaining containerized apps effectively with Docker at your disposal. Always refer to the official Docker docs for advanced usage and more assistance.

Share your Love