Nội dung
Installing Docker on Ubuntu 22.04 with 4 steps.
Introduction
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:
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.
sudo apt install apt-transport-https ca-certificates curl software-properties-common
- Add the GPG key of the Docker repository.
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.
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.
sudo apt update sudo apt-cache policy docker-ce
- Install Docker
sudo apt install docker-ce -y
- Check Docker’s Status
sudo systemctl status docker
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.
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
docker info
- Download Docker Images
docker run hello-world
If the output is similar to the one below, you can access and download the images from Docker Hub.
Please run the command below to view the downloaded images.
docker images
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:
- Hotline 247: 028 888 24768 (Ext 0)
- Ticket/Email: You use the email to register for the service and send it directly to: support@azdigi.com .