How to Install Docker on Ubuntu
You install Docker on Ubuntu via the official Docker repository. This gives you the latest version of Docker Engine and Docker Compose, and everything stays up to date via apt. With Docker you run applications in isolated containers. Ideal for tools such as n8n, databases and web applications on your VPS.
Step 1: add the Docker repository
apt update
apt install -y ca-certificates curl
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
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" > /etc/apt/sources.list.d/docker.list Step 2: install Docker
apt update
apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin Step 3: test the installation
docker run hello-world
docker compose version If you see the Hello from Docker message, everything works.
Step 4: use Docker without root (optional)
If you work with your own user, add it to the docker group and log in again:
usermod -aG docker beheerder Docker on AlmaLinux
dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
systemctl enable --now docker Note: Docker and your firewall
Ports that you publish with Docker bypass UFW and are directly reachable from the internet. Publish a port locally only if it does not need to be public, for example with -p 127.0.0.1:5432:5432.
Related articles
Fast NVMe VPS for your apps
NVMe storage with high IOPS and low latency for Docker, databases, AI models and self-hosted apps, in the data centre in Amsterdam.