Quick answer
How do I install Docker on a VPS?
To install Docker on a VPS, remove any distro Docker packages, add Docker's signing key and apt repository, then install docker-ce with the Compose plugin and run hello-world. It takes about 6 commands on Ubuntu or Debian. A SaltVPS Crystal server (2 vCPU / 6 GB / 120 GB) is sized for several containers.
In brief
- Source: Docker's own repository at download.docker.com, not the older docker.io package.
- Packages: docker-ce, docker-ce-cli, containerd.io, docker-buildx-plugin, docker-compose-plugin.
- Compose: now a plugin, called as
docker composewith a space. - Trap: ports published by Docker skip ufw rules unless you bind them to 127.0.0.1.
- Systems: Ubuntu and Debian use apt; AlmaLinux and Rocky Linux use Docker's RHEL repository.
How do you install Docker on an Ubuntu or Debian VPS?
Run these as root, or prefix each with sudo. Replace ubuntu with debian in the URLs on a Debian server.
Remove old packages
Run
apt remove docker.io docker-compose docker-doc podman-docker containerd runc. It is fine if apt says none are installed.Install the prerequisites
Run
apt updatethenapt install ca-certificates curl.Add Docker's signing key
Run
install -m 0755 -d /etc/apt/keyrings, thencurl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc, thenchmod a+r /etc/apt/keyrings/docker.asc.Add the repository
Create the Docker source file in
/etc/apt/sources.list.d/exactly as shown on docs.docker.com for your system. It names your release codename and the key file.Install Docker Engine
Run
apt update, thenapt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin.Test it
Run
docker run hello-world. A greeting message means the engine pulled and ran a container. Check Compose withdocker compose version.
How does the Docker install differ between systems?
SaltVPS offers Debian 13, Debian 12, Ubuntu 24.04 LTS, Ubuntu 22.04 LTS, AlmaLinux 10, Rocky Linux 10; Docker publishes packages for each family.
| System | Package manager | Docker repository | Starts on its own |
|---|---|---|---|
| Ubuntu 24.04 / 22.04 LTS | apt | download.docker.com/linux/ubuntu | Yes, after install |
| Debian 13 / 12 | apt | download.docker.com/linux/debian | Yes, after install |
| AlmaLinux 10 / Rocky Linux 10 | dnf | download.docker.com/linux/rhel | No: run systemctl enable --now docker |
How do you install Docker on AlmaLinux or Rocky Linux?
Add Docker's RHEL repository with dnf, install the same five packages, then start the service.
dnf -y install dnf-plugins-corednf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repodnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-pluginsystemctl enable --now docker
Accept the GPG key fingerprint when dnf asks, after checking it against the one printed on docs.docker.com.
Why can Docker ports get past the ufw firewall?
Docker writes its own iptables rules, and a published port is reachable even when ufw denies it. Docker's documentation states this plainly. A container started with -p 8080:80 answers on the public IP whatever ufw says.
Two safe habits help. Bind private services to localhost, as in -p 127.0.0.1:8080:80, and put a reverse proxy in front. Or only publish ports you mean to expose. The ufw guide covers the rest of the firewall setup.
Which VPS size is best for Docker?
It depends on the containers, not on Docker itself, which adds little overhead. SaltVPS checked its plan list on 16 November 2026: RAM runs from 2 GB on Grain to 32 GB on Dome, all on NVMe disks. A single small app fits Grain. Crystal (6 GB, 120 GB NVMe) leaves room for a database, a reverse proxy and a few services at $6.75 a month on 12 months.
Images and volumes fill disks quietly; docker system df shows the space used. The Docker VPS comparison goes deeper, and running a trading bot is a worked Compose example.
Docker on a VPS: questions
Can I run Docker without sudo?
Add your user to the docker group with usermod -aG docker youruser, then log out and back in. That group has root-level power on the host, so give it only to admins.
Should I use the convenience script from get.docker.com?
Docker says it is meant for test and development setups. On a server you keep, the repository method is easier to audit and update.
Does Docker work on a KVM VPS?
Yes. KVM gives the server its own kernel, so Docker runs as it would on a physical machine.
How do I update Docker later?
With the normal system updates: apt upgrade or dnf upgrade pulls new Docker packages from the repository.
Is docker-compose the same as docker compose?
docker compose is the current plugin. The older docker-compose tool is no longer maintained by Docker.
Verdict
- Install Docker on a VPS from Docker's own repository, then test with hello-world.
- Bind private ports to 127.0.0.1, because published ports skip ufw rules.
Sources (4)
- Install Docker Engine on Ubuntu — Docker (2026-11-16)
- Install Docker Engine on Debian — Docker (2026-11-16)
- Install Docker Engine on RHEL — Docker (2026-11-16)
- Packet filtering and firewalls (Docker with ufw) — Docker (2026-11-16)
A KVM server ready for containers
Crystal pairs 6 GB of RAM with 120 GB NVMe, with root over SSH and a dedicated IPv4.
- Built by a person, 1 hour at most after confirmation
- Lost days credited back if a server cannot be delivered
- Pay in BTC, XMR, USDT, USDC, ETH, SOL or LTC
- DomaineGoat LLC · Panama