In this tutorial, we will guide you through the installation of Docker on your VPS under Linux (Debian or Ubuntu).

Docker compatibility (CPU)

To work, your CPU must accept virtualization. On a VPS server hosted by mTxServ, you will have no problem.

If you are not hosted with us, you can type the following command to check the compatibility with Docker (you should not get any error!):

lscpu | grep 'vendor\|type'

If all goes well, you should see something close to :

Hypervisor vendor:   KVM
Virtualization type: full

Installing Docker

To install docker, connect as administrator to your server.

We start by installing the dependencies :

apt update 
apt install -y apt-transport-https ca-certificates curl gnupg

We can now launch the installation of Docker :

curl -sSL https://get.docker.com/ | CHANNEL=stable bash
systemctl enable --now docker
systemctl restart docker

To check that everything is working :

docker version

Docker is installed on your system!

Allow a user to use Docker

Currently, only the user root is allowed to use Docker on our operating system.

To authorize another user, you need to add the docker group to it, with the usermod command. For example, to authorize the user www-data :

usermod -aG docker www-data

Installation of docker-compose

Docker Compose is a system that allows you to use YAML files to easily configure Docker for your project.

The main configuration file is docker-compose.yml. Docker Compose reads this file to create the configuration of the containers necessary for the good functioning of our application.

To install Docker Compose, enter the following commands as administrator:

curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

It only remains to check the correct operation with docker-compose version :

docker-compose version 1.27.4, build 40524192
docker-py version: 4.3.1
CPython version: 3.7.7
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019