ContentsOption 1: Installing Docker from Official RepositoryOption 2: Installing Docker from default RepositoriesUse Docker on Ubuntu 20.04
ContentsOption 1: Installing Docker from Official RepositoryOption 2: Installing Docker from mặc định RepositoriesUse Docker on Ubuntu 20.04


Docker is a set of platform-as-a-service products used lớn launch và manage containers. Developers use Docker containers for developing and deploying applications because they provide isolated, lightweight, virtual environments.

Bạn đang xem: How to install docker on ubuntu 22

In this tutorial, learn how to lớn install Docker on Ubuntu 20.04. We also cover basic commands to get you started.


Step 5: Starting Docker Service

Start the Docker service by running:

sudo systemctl start dockerThen, enable it khổng lồ run at startup:

sudo systemctl enable dockerTo check the status of the service, run:

sudo systemctl status dockerThe output đầu ra should verify Docker isactive (running).

Use Docker on Ubuntu 20.04

The basic syntax for docker commands is:

sudo docker [option> [command> [argument>

Run Docker Commands Without Sudo

By default, you can only use the docker commands with root privileges. Ubuntu requires the use of the sudo prefix. For example, if you try khổng lồ run a hello-world container, the output displays permission was denied.

It is advisable khổng lồ keep the settings as is. However, you can bypass typing sudo every time. Adding the user to the docker group grants privileges equivalent khổng lồ root.

1. First, create the docker group with the command:

sudo groupadd docker2. Then, type the following command (making sure khổng lồ replace with your username):

sudo usermod -aG docker [user>3. Enable the new settings with:

su - [user>4. Lastly, kiểm tra to confirm the user is now a part of the docker group by running:

id -nG
5. Now you can run the docker run hello-world command without the sudo prefix.

Working With Docker Images

Docker images are files that contain the source code, libraries, dependencies, tools, và other files a container needs. You can create Docker images with Dockerfiles or use existing ones available on Docker Hub.

To tải về a new Docker image, use the command:

docker pull [image_name>If you don’t know the exact name of the image, tìm kiếm for it in Docker’s repository with:

docker search ubuntuAfter working with Docker for some time, you will collect a local registry of images. Display a list of all Docker images on the system with:

docker images

Working With Docker Volumes

The best way lớn preserve data generated within a container is mounting Docker volumes on to them. Mounted volumes don’t depend on the container life cycle và can share data between containers.

Create a new Docker volume with:

docker volume create [volume_name>To create a container and mount a volume to it, follow the syntax:

docker run --mount source=[volume_name>,destination=[path_in_container> [docker_image>For more information about Docker volumes and how to giới thiệu between containers, refer to lớn Docker Volumes: How khổng lồ Create và Get Started.

Xem thêm: Tổng Hợp Các Thương Hiệu Thời Trang Nổi Tiếng Ở Việt Nam


This article should have helped you install & get started with Docker on Ubuntu 20.04.