---
title: "How to install Docker and Docker Compose on a VPS"
description: "Find out how to install Docker Engine and Docker Compose on an OVHcloud VPS running Debian or Ubuntu via the official repository."
url: https://docs.ovhcloud.com/es/guides/bare-metal-cloud/virtual-private-servers/install-docker-on-vps
lang: es
lastUpdated: 2026-02-25
---
# 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 `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

- [Step 1 - Update the system](#update)
- [Step 2 - Install dependencies](#dependencies)
- [Step 3 - Add the Docker GPG key](#gpg)
- [Step 4 - Add the Docker repository](#repo)
- [Step 5 - Install Docker](#install)
- [Step 6 - Configure Docker permissions](#permissions)
- [Step 7 - Verify the installation](#verify)

## Instructions

### Step 1 - Update the system [](#)
Before installing anything, update your system:

```bash
sudo apt update && sudo apt upgrade -y
```

### Step 2 - Install dependencies [](#)
Install the required packages:

```bash
sudo apt install -y ca-certificates curl gnupg
```

### Step 3 - Add the official Docker GPG key [](#)
```bash
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 [](#)

**Debian 11 / 12**

```bash
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
```


**Ubuntu 22.04+**

```bash
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 [](#)
```bash
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:

```bash
sudo usermod -aG docker $USER
```

Reload your session:

```bash
newgrp docker
```

:::warning

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:

```bash
docker --version
docker compose version
```

You should get output similar to:

```console
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](/es/guides/bare-metal-cloud/virtual-private-servers/install-openclaw.md)
- [Install n8n on an OVHcloud VPS](/es/guides/bare-metal-cloud/virtual-private-servers/install-n8n-on-vps.md)
- [Install Nextcloud on an OVHcloud VPS with Docker and Traefik](/es/guides/bare-metal-cloud/virtual-private-servers/install-nextcloud-on-vps-advanced.md)

[Secure an OVHcloud VPS](/es/guides/bare-metal-cloud/virtual-private-servers/secure-your-vps.md)

Join our [community of users](https://community.ovhcloud.com/).
