Back to articles
Docker Compose Has a Free API That Orchestrates Multi-Container Apps Effortlessly
How-ToDevOps

Docker Compose Has a Free API That Orchestrates Multi-Container Apps Effortlessly

via Dev.to DevOpsAlex Spinov

Docker Compose lets you define and run multi-container applications with a single YAML file. Its v2 API adds watch mode, profiles, and GPU support. Full-Stack App: One File # docker-compose.yml services : api : build : ./api ports : [ " 3000:3000" ] environment : DATABASE_URL : postgres://user:pass@db:5432/scraping REDIS_URL : redis://cache:6379 depends_on : db : { condition : service_healthy } cache : { condition : service_started } develop : watch : - action : sync path : ./api/src target : /app/src - action : rebuild path : ./api/package.json worker : build : ./worker environment : DATABASE_URL : postgres://user:pass@db:5432/scraping REDIS_URL : redis://cache:6379 deploy : replicas : 3 depends_on : [ db , cache ] db : image : postgres:16 environment : POSTGRES_DB : scraping POSTGRES_USER : user POSTGRES_PASSWORD : pass volumes : [ " pgdata:/var/lib/postgresql/data" ] healthcheck : test : [ " CMD-SHELL" , " pg_isready -U user" ] interval : 5s timeout : 5s retries : 5 cache : image :

Continue reading on Dev.to DevOps

Opens in a new tab

Read Full Article
7 views

Related Articles