How to Install Docker on Ubuntu 20.04
Docker is an open source software for creating and managing containers that contain the runtime environment for a single application and include everything it needs to run. Docker is widely used in the process of continuous development, testing, and deployment of software, i.e. DevOps.
In the Serverspace you can create a server with already installed app "Docker".
Docker installation
To install and always get updated to the latest version, you should connect the repository from the Docker developers. First, update the repositories and install the necessary packages.
sudo apt update
sudo apt install software-properties-common ca-certificates curl gnupg-agent apt-transport-https
Prepare the system for adding a repository by adding this key.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Add the repository itself.
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
After executing this command, the system will be ready for installation. Let's do it.
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io
At this point, the installation is complete. Now let's consider some settings and run a test container.
Privileges for Docker
To manage Docker and run commands in it, the user must have sudo privileges. If you want to grant sudo rights in Docker to another user, add him to the docker group. But be careful! Users of this group can get root access on the Docker host. Enter this command and replace user with the required username.
sudo usermod -aG docker user
Running a Docker Test Container
You can check whether docker is capable of running containers with a test container.
docker container run hello-world