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:
- 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 -
- Add the software source.
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- Install the latest version of Docker.
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io
- View service status
sudo systemctl status docker
Test the Docker service
- Execute the following command to add the current user to the Docker user group.
sudo usermod -aG docker $USER
- Log out and log in again.
- 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