How to install Docker and Docker Compose on a VPS
Objective
By the end of this guide, your VPS will have:
- Docker Engine
- Docker Compose (official plugin)
- Permissions configured to avoid using
sudowith 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
- Step 1 - Update the system
- Step 2 - Install dependencies
- Step 3 - Add the Docker GPG key
- Step 4 - Add the Docker repository
- Step 5 - Install Docker
- Step 6 - Configure Docker permissions
- Step 7 - Verify the installation
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:
- Install OpenClaw behind Traefik on an OVHcloud VPS with OVHcloud AI Endpoints
- Install n8n on an OVHcloud VPS
- Install Nextcloud on an OVHcloud VPS with Docker and Traefik
Join our community of users.