Home Linux ServerTools How to install Docker on Ubuntu 22.04

How to install Docker on Ubuntu 22.04

by Thạch Phạm
Published: Last Updated on

Installing Docker on Ubuntu 22.04 with 4 steps.


Docker is an open-source project that automates the deployment of Linux applications into virtualized containers. Docker provides a layer of abstraction and virtualization based on Linux. Docker uses isolated Linux resources such as cgroups, kernel, and file managers to allow containers to run independently within a Linux entity.

Changes are stored in Docker images, and the file system layers are created and saved on a layer-by-layer basis. This helps the Docker Image reduce significantly in size compared to the virtual host (VM).

Applications that want to run using Docker must be applications that can run on Linux. Docker has recently added support for running Windows applications in Windows containers.

Main components of Docker

  • Docker Engine: used to create Docker images and run Docker containers.
  • Docker Hub: a hosting service that holds Docker images.
  • Docker Machine: creates Docker engines on the server.
  • Docker Compose: run the application by defining the configuration of Docker containers through the configuration file.
  • Docker image: a collection of application files generated by the Docker engine. The contents of Docker images will not be changed during migration. Docker images are used to run Docker containers.
  • Docker container: a runtime form of Docker images used as a runtime environment for applications.

Implementation Guide

Step 1: Update the system

You proceed to update the packages installed on the Ubuntu system with the command:

AZDIGI Tutorial
sudo apt update -y && apt upgrade -y

Step 2: Install Docker

To install the latest Docker, you should install it directly from the Docker repository.

  • Install some packages that allow HTTPS.
AZDIGI Tutorial
sudo apt install apt-transport-https ca-certificates curl software-properties-common
  • Add the GPG key of the Docker repository.
AZDIGI Tutorial
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  • Next, add Ubuntu 22.04’s Docker repository (jammy) to apt sources.
AZDIGI Tutorial
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
  • Update packages and set to install Docker from official repositories.
AZDIGI Tutorial
sudo apt update
sudo apt-cache policy docker-ce
How to install Docker on Ubuntu 22.04
  • Install Docker
AZDIGI Tutorial
sudo apt install docker-ce -y
How to install Docker on Ubuntu 22.04
  • Check Docker’s Status
AZDIGI Tutorial
sudo systemctl status docker
How to install Docker on Ubuntu 22.04

Step 3: Configure Sudo permissions for users using Docker

Docker requests are only executed as the root user by default. Therefore, if you use other users, you need to add that user to the Docker group to have the right to operate.

AZDIGI Tutorial
sudo usermod -aG docker username  (Nhớ thay username bằng user của bạn)

Step 4: Use the Docker command

  • View information about Docker
AZDIGI Tutorial
docker info
How to install Docker on Ubuntu 22.04
  • Download Docker Images
AZDIGI Tutorial
docker run hello-world

If the output is similar to the one below, you can access and download the images from Docker Hub.

How to install Docker on Ubuntu 22.04

Please run the command below to view the downloaded images.

AZDIGI Tutorial
docker images
How to install Docker on Ubuntu 22.04

The above are preliminary to a few common commands, in future articles, AZDIGI will guide more on the common commands on Docker.

So AZDIGI has completed the steps to install Docker on Ubuntu 22.04. Hopefully, this article will be helpful to you. Wishing you success!

You can refer to other instructions at the link below:

If you need support, you can contact support in the ways below:

Đánh giá

Tham gia nhóm hỗ trợ Server - Hosting

Tham gia nhóm Hỗ trợ Server - Hosting & WordPress để cùng nhau hỏi đáp và hỗ trợ các vấn đề về WordPress, tối ưu máy chủ/server.

Tham gia ngay

Bài viết cùng chuyên mục

AZDIGI – Không chỉ là đơn vị hàng đầu trong lĩnh vực Web Hosting và Máy chủ, chúng tôi mong muốn mang lại những kiến thức bổ ích nhất và luôn cập nhật thường xuyên cho cộng đồng người đam mê thiết kế website, công nghệ,…

Vui lòng không sao chép nội dung nếu chưa xin phép. Designed and Developed by PenciDesign