рдореБрдЦреНрдп рдордЬрдХреБрд░рд╛рдХрдбреЗ рдЬрд╛
JobCannon
рд╕рд░реНрд╡ рдХреМрд╢рд▓реНрдпреЗ

Docker Compose

Multi-container apps: define, run, orchestrate locally

тмв рд╢реНрд░реЗрдгреА 3рдЕрд╡рдЬрд╛рд░реЗ
+$10k-
рдкрдЧрд╛рд░рд╛рд╡рд░реАрд▓ рдкрд░рд┐рдгрд╛рдо
2 рдорд╣рд┐рдиреЗ
рд╢рд┐рдХрдгреНрдпрд╛рд╕ рд▓рд╛рдЧрдгрд╛рд░рд╛ рд╡реЗрд│
рдордзреНрдпрдо
рдХрд╛рдард┐рдгреНрдп
тАФ
рдХрд░рд┐рдЕрд░реНрд╕
рдПрдХрд╛ рджреГрд╖реНрдЯрд┐рдХреНрд╖реЗрдкрд╛рдд

Docker Compose is the lightweight orchestration tool for multi-container applications (web + database + cache + worker services) without Kubernetes complexity. Write once in YAML, run anywhere: local dev тЖТ CI/CD тЖТ small production. Learning: 1тАУ2 months. Career path: Practitioner (compose files, networking, 1тАУ3 services, $90тАУ110k) тЖТ Operator (volumes, healthchecks, scaling, $110тАУ130k) тЖТ Architect (production patterns, multi-host, $130тАУ160k). Tools: Docker Desktop, Docker Engine, Compose CLI, BuildKit, OrbStack/Colima for Mac. Salary: +$10kтАУ$25k for backend/DevOps roles.

Docker Compose рдореНрд╣рдгрдЬреЗ рдХрд╛рдп

Docker Compose defines multi-container applications (web + db + redis) in YAML. Essential for local development and simple deployments. L1: docker-compose.yml, up/down/logs

ЁЯФз рд╕рд╛рдзрдиреЗ рдЖрдгрд┐ рдкрд░рд┐рд╕рдВрд╕реНрдерд╛
Docker DesktopDocker EngineDocker ComposeDocker SwarmPodmanOrbStackColimaDocker BuildxBuildKitDockerfile linting tools

ЁЯТ░ рдкреНрд░рджреЗрд╢рд╛рдиреБрд╕рд╛рд░ рдкрдЧрд╛рд░

рдкреНрд░рджреЗрд╢рдЬреНрдпреБрдирд┐рдпрд░рдордзреНрдпрдорд╕реАрдирд┐рдпрд░
USA$95k$125k$155k
UK┬г55k┬г75k┬г95k
EUтВм60kтВм80kтВм105k
CANADAC$100kC$130kC$165k

тЪЦ рдпрд╛рдВрдЪреНрдпрд╛рд╢реА рддреБрд▓рдирд╛ рдХрд░рд╛

тЭУ FAQ

When should I use Compose vs Kubernetes for production?
Compose: single-host, < 10 services, simple stateless apps, small team, ~weeks of ops experience. K8s: multi-host clusters, auto-scaling, HA, > 10 services, large teams, months of ops learning. Cost crossover: Compose on t3.large ($30/mo) vs K8s managed ($150+/mo for minimal cluster). For most early-stage startups, Compose wins until you hit 100K+ daily users or need multi-region failover.
How do I handle persistent data with volumes?
Named volumes (docker volume create mydata, mount: mydata:/db) for stateful services. Host volumes (host:container path) for dev but NOT prod. Volumes survive container restarts, but backup is manual. For production, use external managed DBs (RDS, MongoDB Atlas) instead; Compose is for orchestration, not persistence.
What's the difference between BuildKit and the standard Docker build?
BuildKit is 10-50x faster, supports parallel layer builds, better caching, multi-stage secrets. Enable with DOCKER_BUILDKIT=1 docker build. In compose.yml: set buildkit context. Standard build is synchronous, slow for large images. BuildKit is the default in Docker 4.0+.
Can I run Compose on Apple Silicon Macs?
Docker Desktop on M1/M2/M3 works but is 20-30% slower than native arm64 images. Use OrbStack (faster, lighter) or Colima (free, QEMU-based) as alternatives. Specify arm64 images in Dockerfile: FROM --platform=linux/arm64 alpine. Multi-stage builds test on amd64 first to avoid arm64-only breakage in CI.
How do I debug networking issues between services?
Use 'docker compose exec servicename sh' to enter containers. Test DNS: ping database (service name = DNS hostname in same network). Check logs: 'docker compose logs servicename'. Port mapping: localhost:3000 for host access, but service-to-service uses servicename:port only (not localhost). Network name defaults to dirname_default.
What's the recommended pattern for environment variables in compose?
Use .env file (git-ignored) for dev, docker compose --env-file production.env for prod, or Docker secrets for sensitive data (passwords/API keys, mount as read-only /run/secrets/key). Never hardcode secrets in compose.yml. Use ${VARIABLE} syntax in compose.yml to interpolate.
How do I optimize startup time and multi-stage builds?
Separate build stage from runtime: FROM node AS builder (npm install + compile) тЖТ FROM alpine (copy only /dist). BuildKit caches layer-by-layer, so order dependencies before code. Use docker compose --abort-on-container-exit for test runs. Healthchecks (curl http://localhost:3000) ensure service readiness before dependent services start.

рд╣реЗ рдХреМрд╢рд▓реНрдп рддреБрдордЪреНрдпрд╛рд╕рд╛рдареА рдпреЛрдЧреНрдп рдЖрд╣реЗ рдХрд╛, рдпрд╛рдЪреА рдЦрд╛рддреНрд░реА рдирд╛рд╣реА?

рдХрд░рд┐рдЕрд░ рдореЕрдЪ рдХрд░реВрди рдкрд╛рд╣рд╛ тАФ рдЖрдореНрд╣реА рдпреЛрдЧреНрдп рдорд╛рд░реНрдЧ рд╕реБрдЪрд╡реВ.

рдорд╛рдЭреНрдпрд╛рд╕рд╛рдареА рд╕рд░реНрд╡реЛрддреНрддрдо рдХреМрд╢рд▓реНрдпреЗ рд╢реЛрдзрд╛ тЖТ

рддреБрдордЪрд╛ рдЖрджрд░реНрд╢ рдХрд░рд┐рдЕрд░ рдорд╛рд░реНрдЧ рд╢реЛрдзрд╛

реи,релреирез рдХрд░рд┐рдЕрд░рдордзреНрдпреЗ рдХреМрд╢рд▓реНрдпрд╛рдВрд╡рд░ рдЖрдзрд╛рд░рд┐рдд рдЬреБрд│рдгреА. рдореЛрдлрдд, ~3 рдорд┐рдирд┐рдЯреЗ.

рдХрд░рд┐рдЕрд░ рдореЕрдЪ рдХрд░реВрди рдкрд╛рд╣рд╛ тАФ рдореЛрдлрдд тЖТ