Docker lets you package applications and their dependencies into portable containers that run the same way everywhere. Here's how to install it on an Ubuntu or Debian VPS.

1. Install Docker Engine

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

2. Verify the install

sudo docker run hello-world

If you see the welcome message, Docker is working.

3. Run Docker without sudo (optional)

sudo usermod -aG docker $USER
# log out and back in for this to take effect

4. Run your first real container

docker run -d --name web -p 80:80 nginx

Visit your server's IP and you'll see the Nginx welcome page, served from a container.

5. Use Docker Compose for multi-container apps

Create a docker-compose.yml to run several services together (for example, an app plus a database), then start them with:

docker compose up -d

Resource tips

Docker itself is lightweight, but your containers still need CPU and RAM. A VPS with dedicated, guaranteed resources (like a KVM-based OneHost Linux VPS on NVMe SSD) gives containers predictable performance with no noisy-neighbour surprises.