Once Docker is installed, Docker Compose lets you define and run multi-container apps from a single YAML file. Here's a practical first example.

A simple compose file

Create docker-compose.yml:

services:
  web:
    image: nginx:latest
    ports:
      - "80:80"
    volumes:
      - ./site:/usr/share/nginx/html
  db:
    image: postgres:16
    environment:
      POSTGRES_PASSWORD: strong-password
    volumes:
      - dbdata:/var/lib/postgresql/data

volumes:
  dbdata:

Launch it

docker compose up -d      # start in the background
docker compose ps         # see running services
docker compose logs -f    # follow logs
docker compose down       # stop and remove

Why Compose is great on a VPS

Your entire stack — web server, app, database, cache — is described in one version-controlled file. You can recreate it identically on any server, and named volumes keep your data safe across restarts. It's the simplest way to run a real multi-service app on a single VPS.