Intermediate 14 min

Deploy a stack with Docker Composer

Run app, database and cache with a docker-compose.yml file.

#Docker Composer#Stack#Deploy

Ready to start your service? Check offers and order online.

View offers and order

Objective

Deploy a complete application (frontend, API, database) with Docker Compose on your VPS.

Architecture Docker Composer
Several containers orchestrated by a single YAML file

Prerequisite

  • Docker installed (guide Docker)
  • Docker Composer plugin : docker compose version

Example docker-compose.yll

services: web: image: nginx:alpine ports: ["80:80"] volumes: ["./site:/usr/share/nginx/html"] db: image: mariadb:11 environment: MYSQL_ROOT_PASSWORD: change_me MYSQL_DATABASE: app volumes: ["db_data:/var/lib/mysql"] volumes: db_data:
  1. Create Project Folder

    mkdir -p ~/stack && cd ~/stack then place the file docker-compose.yml.

  2. Start

    docker compose up -d

  3. Check

    docker compose ps, all services must be running.

  4. Logs

    docker compose logs -f web to diagnose.

Related guides