In this manual we will show 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.
This manual covers the installation of Docker for the Ubuntu 18.04 distribution. The procedure will be very similar for 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.
All commands in this manual assume that they are executed with
root permissions. Depending on the configuration of each system, it may be necessary to precede them with
First, we will proceed to install the repositories, as well as the necessary dependencies.
apt-get install apt-transport-https ca-certificates curl software-properties-common
The above command will install the necessary dependencies to be able to add and work correctly with a repository through a secure connection.
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 sender, thus avoiding any kind of packet / file spoofing. This is a standard and common security measure.
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 case this manual is used in other versions of Ubuntu or distributions derived from Ubuntu, it will be necessary to change this word to ensure compatibility.
Finally, we will update the list of packages, thus enabling the repository.
apt-get install docker-ce
The package name
docker-ce refers to the free ("community edition") version of Docker.
docker container run hello-world
success You are done! If you have followed all the steps correctly, you have successfully installed Docker on your Ubuntu server.