How to install Docker and Docker Compose on a VPS

Knowledge Base

How to install Docker and Docker Compose on a VPS


Icons/System/eye-open Created with Sketch. 6 Views 25.02.2026 Virtual Private Servers

Objective

By the end of this guide, your VPS will have:

  • Docker Engine
  • Docker Compose (official plugin)
  • Permissions configured to avoid using sudo with Docker

Installing via the official Docker repository ensures regular updates, improved stability and maximum compatibility with recent tools.

This guide explains how to install Docker Engine and Docker Compose on an OVHcloud VPS.

Requirements

  • An active OVHcloud VPS running Debian 11/12 or Ubuntu 22.04 and later
  • SSH access with a user that has sudo privileges

Table of Contents

Instructions

Step 1 - Update the system

Before installing anything, update your system:

sudo apt update && sudo apt upgrade -y

Step 2 - Install dependencies

Install the required packages:

sudo apt install -y ca-certificates curl gnupg

Step 3 - Add the official Docker GPG key

sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

Step 4 - Add the Docker repository

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Step 5 - Install Docker Engine and Docker Compose

sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Step 6 - Configure Docker permissions

By default, Docker commands require sudo.

To avoid permission issues when using Docker Compose or installation scripts, add your user to the docker group:

sudo usermod -aG docker $USER

Reload your session:

newgrp docker

Do not run your future Docker scripts with sudo unless specifically required. Using sudo can create root-owned files and cause permission errors.

Step 7 - Verify the installation

Check that Docker is working correctly:

docker --version
docker compose version

You should get output similar to:

Docker version 29.x.x, build xxxxxxx
Docker Compose version v2.x.x

Go further

You can now use Docker to:

Secure an OVHcloud VPS

Join our community of users.

Related articles