Updated: 11 October 2026 · Applies to: Ubuntu 24.04, Debian 12, AlmaLinux 9 and Rocky Linux 9
Docker runs applications in containers, so each app brings its own dependencies. Install it on a Ucartz VPS with Ubuntu 24.04, Debian 12, AlmaLinux 9 and Rocky Linux 9.
Install Docker Engine (official repository)
Ubuntu 24.04 / Debian 12:
apt install 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 tee /etc/apt/sources.list.d/docker.sources <<EOF Types: deb URIs: https://download.docker.com/linux/ubuntu Suites: $(. /etc/os-release && echo "$VERSION_CODENAME") Components: stable Architectures: $(dpkg --print-architecture) Signed-By: /etc/apt/keyrings/docker.asc EOF apt update apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
On Debian, use https://download.docker.com/linux/debian in both the key URL and URIs.
AlmaLinux 9 / Rocky Linux 9:
dnf install dnf-plugins-core dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin systemctl enable --now docker
Test with docker run hello-world. Compose is available as docker compose.
First containers
docker run -d --name web -p 80:80 nginx docker ps docker logs web docker stop web && docker rm web
Compose
Describe multi-container apps in compose.yaml and start them with docker compose up -d.
Note: KVM VPS (as used by Ucartz) run Docker without restrictions. Keep images updated with docker compose pull && docker compose up -d.
Why use Docker on a VPS
- Each app runs with its own dependencies, so two apps never conflict (for example two WordPress sites with different PHP versions).
- The same image runs on your laptop and on the server, so what you tested is what you deploy.
- A crashed container does not affect other containers, and
--restart unless-stoppedstarts it again automatically, also after a reboot. - Moving an app to another server means copying its compose file and volumes.
Everyday commands
docker images # downloaded images docker ps -a # all containers, also stopped ones docker exec -it web sh # open a shell inside a container docker logs -f web # follow the log docker volume ls # data volumes (back these up) docker system df # disk space used by Docker
Note: Clean up unused images with docker image prune. Be careful with docker system prune --volumes: it deletes volumes that no container uses, including data.
Common problems
- permission denied ... docker.sock: run the command with sudo, or add your user to the docker group and log in again.
- Port is already allocated: another container or service (often Apache or Nginx) already uses that port. Check with
ss -tlnp. - The disk fills up: limit log size in
/etc/docker/daemon.jsonwith{"log-driver": "json-file", "log-opts": {"max-size": "10m", "max-file": "3"}}and restart Docker.