news
Serverspace has added a new Rocky Linux OS
JH
Joe Harris
December 23, 2020
Updated June 7, 2023

How to Install Docker on Ubuntu 20.04

Linux Ubuntu

Using another OS?

Select the desired version or distribution.

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

After loading the image, you will see a message that the container was launched successfully.

Vote:
5 out of 5
Аverage rating : 5
Rated by: 1
1101 CT Amsterdam The Netherlands, Herikerbergweg 292
+31 20 262-58-98
700 300
ITGLOBAL.COM NL
700 300
We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.