Guide

Docker on a VPS

Last updated: 15 November 2026

Docker lets you run apps in containers with one command. This guide installs Docker Engine and the Compose plugin from Docker's official repository on Ubuntu; for the current steps on any system see the official instructions at docs.docker.com/engine/install. If you are logged in as root, leave out sudo.

Fast VPS from $7.99 a month

See Fast VPS plansHow ordering works

What size

Docker itself is light. Size the VPS by the apps you run: 2 GB of RAM for a few small containers, 4 GB or more for databases and several services. Fast VPS plans start at $7.99 a month: Fast 1-2 (1 vCPU, 2 GB RAM, 20 GB NVMe), 2-4 (2 vCPU, 4 GB, 40 GB), 4-8 (4 vCPU, 8 GB, 60 GB) and larger, with full root access. Order page: Fast VPS.

Install (Ubuntu)

sudo apt update
sudo apt install -y ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

On Debian use https://download.docker.com/linux/debian in the key URL and the repository line.

Test it

sudo docker run --rm hello-world
sudo docker compose version

Run an app with Compose

  1. Put a compose.yaml in a folder for the app and start it with sudo docker compose up -d.
  2. Add restart: unless-stopped to each service so containers come back after a reboot.
  3. See logs with sudo docker compose logs -f.

Mistakes to avoid

Related

SSH keys · First login · Self-hosting guide

Questions and answers

How do I install Docker on an Ubuntu VPS?
Add Docker's official apt repository and install docker-ce, docker-ce-cli, containerd.io, docker-buildx-plugin and docker-compose-plugin.

Does ufw protect Docker ports?
Not reliably: Docker publishes ports through its own rules. Bind private services to 127.0.0.1.

How do I make containers start after a reboot?
Set restart: unless-stopped on each service in the Compose file.

Is adding a user to the docker group safe?
It gives that user root-equivalent power on the server, so do it only for users you trust.

Ready to try it? Fast VPS from $7.99 a month

See Fast VPS plansHow ordering works