Home / Guides / Docker

Docker + Compose on VPS in 6 minutes

Works on any Ubuntu 22.04/24.04 server. Every plan on /vps is KVM โ€” Docker runs natively, no container-in-container hacks.

1. Install the stack

ssh root@YOUR_SERVER_IP
curl -fsSL https://get.docker.com | sh
docker --version && docker compose version

The official script installs Engine + Compose plugin and enables the service at boot.

2. Optional: run Docker without sudo

adduser deploy
usermod -aG docker deploy
# re-login as deploy for the group to apply

3. First compose project

mkdir -p /opt/demo && cd /opt/demo
cat > docker-compose.yml <<'EOF'
services:
  web:
    image: nginx:alpine
    restart: unless-stopped
    ports:
      - "8080:80"
EOF
docker compose up -d
curl -s localhost:8080 | head -3

4. Verify reboot survival

reboot
# ...wait ~30s, reconnect:
docker compose -f /opt/demo/docker-compose.yml ps   # โ†’ running

restart: unless-stopped + Docker enabled at boot = your containers come back on their own. Need a server for this? Plans from โ‚ฌ3/mo โ†’

Related