As we said in previous articles, a container is a process that runs on a host, and multiple containers use the same host’s operating system kernel. Here, take the Ubuntu20.04 system as an example to explain the installation process of the Docker container.

Installation:

  1. Install dependencies.
sudo apt update
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  1. Add the software source.
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
  1. Install the latest version of Docker.
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io
  1. View service status
sudo systemctl status docker

Test the Docker service

  1. Execute the following command to add the current user to the Docker user group.
sudo usermod -aG docker $USER
  1. Log out and log in again.
  2. Run the sample container by executing the following command.
docker run hello-world

If you can output the message Hello from Docker, the installation is successful.

Project directory