CloudLinux.ro
Docker & containers

How to use Docker Compose for multi-service apps

Updated 7/20/2026

Real applications have several parts: a web server, a database, maybe a cache. Docker Compose describes them all in one file and starts them together.

1. The compose.yaml file

services:
  web:
    image: nginx
    ports:
      - "80:80"
  db:
    image: mysql:8
    environment:
      MYSQL_ROOT_PASSWORD: password
    volumes:
      - db_data:/var/lib/mysql

volumes:
  db_data:

2. Start everything

docker compose up -d

3. Useful commands

docker compose ps        # service status
docker compose logs -f   # live logs
docker compose down      # stop and remove containers

Why Compose

  • All configuration in one file, easy to version in git.
  • Services reach each other by name (web can access "db").
  • Volumes keep data even if you recreate containers, see Docker volumes.

For a full app with a proxy and HTTPS, see How to deploy an app with Docker Compose.

Put this guide into practice on your own VPS

EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.

See pricing

Related tutorials