Skip to content

079 - Docker Compose

Multi-container application definition. This is an example of a MAML document.

maml
{
  version: "3.8"
  services: {
    app: {
      image: "node:20-slim"
      ports: [
        "3283:3681"
      ]
      environment: {
        NODE_ENV: "production"
        DATABASE_URL: "postgres://db:5432/trolley"
      }
      depends_on: [
        "db"
        "redis"
      ]
    }

    db: {
      image: "postgres:16"
      volumes: [
        "db_data:/var/lib/postgresql/data"
      ]
      environment: {
        POSTGRES_DB: "arcade"
        POSTGRES_PASSWORD: "hI1a0pfQJeIFx9U"
      }
    }

    redis: {
      image: "redis:7-alpine"
      ports: [
        "6379:6379"
      ]
    }
  }

  volumes: {
    db_data: {}
  }
}

See Also