How to install Docker on your own server

Aggiornato il 2026-10-24 22:01:19 55 visite

In this manual, we will teach you how to install and configure Docker on your own server. By following these simple steps, you will be able to have Docker installed and fully functional in just a few minutes, allowing you to launch containers or 'compose' multi-container architectures.

Prerequisites

This manual covers the installation of Docker for the Ubuntu 18.04 distribution. The procedure will be very similar in later versions of Ubuntu and even for any Debian-based distribution. However, the steps detailed below will not work for distributions such as Red Hat, Fedora, CentOS, etc.

  • Ubuntu 18.04 (or compatible)
  • Root access
  • SSH or terminal connection

All commands in this manual assume they are run with root permissions. Depending on each system's configuration, it may be necessary to precede them with sudo.

Repository Installation

First, we will proceed to install the repositories, as well as the necessary dependencies.

1. Update the package list

apt-get update

2. Ensure connection to repositories via the HTTPS protocol can be established

apt-get install apt-transport-https ca-certificates curl software-properties-common

The previous command will install the necessary dependencies to be able to add and work correctly with a repository through a secure connection.

3. Download and add the Docker repository public key

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

This key will allow us to verify the integrity of the files and the authenticity of the issuer, thereby avoiding any type of package / file spoofing. This is a standard and common security measure.

4. Add the repository and update the package list

add-apt-repository 'deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable'

info Note that the previous command includes the release name of the distribution. In this case, bionic. In the event that this manual is used in other versions of Ubuntu or Ubuntu-derived distributions, it will be necessary to change this word to ensure compatibility.

apt-get update

Finally, we will update the package list, thereby enabling the repository.

5. Install Docker using the package manager

apt-get install docker-ce

The package name docker-ce refers to the free version ('community edition') of Docker.

6. Test the installation by running the 'hello-world' container

docker container run hello-world

success That's it! If you have followed all the steps correctly, you have successfully installed Docker on your Ubuntu server.