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.
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.
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.
sudo docker run --rm hello-world
sudo docker compose versioncompose.yaml in a folder for the app and start it with sudo docker compose up -d.restart: unless-stopped to each service so containers come back after a reboot.sudo docker compose logs -f.127.0.0.1 (for example "127.0.0.1:5432:5432"). See firewall with ufw.docker group is the same as giving it root rights; do it only for users you trust.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.