Title: Docker Compose Recipes For Local Dev — LearnCoachAssist

Q: Compose file directive to mount a host directory into a container?
A: volumes: - ./local:/app

Q: Restart a container automatically unless explicitly stopped?
A: restart: unless-stopped

Q: Define an environment variable in Compose?
A: environment:<br> - KEY=value or env_file: .env

Q: Wait for another service to be 'healthy' before starting?
A: depends_on:<br> db:<br> condition: service_healthy

Q: Define a healthcheck for a Postgres container?
A: healthcheck:<br> test: ['CMD-SHELL','pg_isready -U postgres']<br> interval: 5s<br> retries: 10

Q: Expose a port to the host vs to other services only?
A: ports: - '5432:5432' publishes to host.
expose: - '5432' reachable only on the Compose network.

Q: Default Compose network name?
A: <project>_default — services on this network can resolve each other by service name.

Q: Persist Postgres data across container recreations?
A: Use a named volume: volumes:<br> - pg_data:/var/lib/postgresql/data and declare volumes:<br> pg_data: at the bottom.

Q: Run a one-off command without modifying compose.yml?
A: docker compose run --rm web bash

Q: Rebuild after Dockerfile changes?
A: docker compose build (or up --build).

Q: View logs of one service in real time?
A: docker compose logs -f web

Q: Scale a stateless service to 3 replicas?
A: docker compose up -d --scale worker=3

Q: Override Compose file for prod?
A: docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d

Q: Best place to put secrets in dev?
A: .env file referenced via env_file, gitignored. For prod use real secrets manager.

Q: Common gotcha: containers can't reach 'localhost'?
A: Inside a container, localhost means the container itself. Use the service name (db) or host.docker.internal (Docker Desktop).

Q: Define a build context with custom Dockerfile path?
A: build:<br> context: ./app<br> dockerfile: Dockerfile.dev

Q: Per-service resource limits?
A: deploy:<br> resources:<br> limits:<br> cpus: '1.5'<br> memory: 512M

Q: Force pull latest image on up?
A: docker compose pull && docker compose up -d

Q: Stop and remove containers + volumes?
A: docker compose down -v  ⚠ destroys data.

Q: Inspect why a service crashed?
A: docker compose ps shows status; docker compose logs web shows stderr.

Q: Pin to specific Compose file version?
A: Use the modern format: omit version: entirely — Compose v2+ no longer requires it and infers from features.

Q: Mount a single config file as read-only?
A: volumes: - ./nginx.conf:/etc/nginx/nginx.conf:ro

Q: Define a profile so a service starts only with a flag?
A: profiles: - debug then docker compose --profile debug up.

Q: Run Compose under different project name?
A: docker compose -p myname up or set COMPOSE_PROJECT_NAME.

Q: Best way to seed a DB on first start?
A: Mount SQL files into /docker-entrypoint-initdb.d/ for Postgres/MySQL — runs once on empty data dir.

Q: Pre-build only one service?
A: docker compose build web

Q: Print fully resolved Compose config?
A: docker compose config — useful for debugging env interpolation.

Q: Use a secret in Compose?
A: secrets:<br> db_pwd:<br> file: ./secrets/db_pwd.txt + reference in service.

Q: Sample minimal LAMP stack?
A: Services: php-fpm, nginx (mounts site.conf), mysql (volume + env). Link via Compose default network.

Q: Common cause of 'service not found' on docker compose run?
A: Service name typo, or wrong working directory — Compose only loads docker-compose.yml in the current dir unless -f is set.

Q: Make web wait for db reachable, not just up?
A: Add a healthcheck on db; use depends_on: db: condition: service_healthy; in app, also retry connect on startup.

Q: Override container env from CLI?
A: WEB_PORT=4000 docker compose up — only works if compose.yml uses ${WEB_PORT} interpolation.

Q: Best practice: separate compose for prod?
A: Keep base file with shared services, add docker-compose.override.yml (dev) auto-loaded, and docker-compose.prod.yml opt-in via -f.

Q: Top-level keys in a Compose file?
A: services, networks, volumes, secrets, configs, name (and legacy version).

Q: Service-level keys you'll use most?
A: image, build, ports, environment, env_file, volumes, depends_on, healthcheck, restart, command, networks.

Q: Define a custom network?
A: networks:<br> backend:<br> driver: bridge, then reference under service networks: [backend].

Q: Attach a service to multiple networks?
A: List under the service: networks: [frontend, backend] — useful for gateway/reverse-proxy patterns.

Q: External network use?
A: networks:<br> shared:<br> external: true — joins a network created outside this compose file.

Q: Custom container name?
A: container_name: my-web — disables scaling; use sparingly.

Q: Set the working directory inside container?
A: working_dir: /usr/src/app

Q: Override the entrypoint?
A: entrypoint: ['./wait-for-it.sh', 'db:5432', '--']

Q: Provide command-line args to image's entrypoint?
A: command: ['npm', 'run', 'dev']

Q: Define a tmpfs mount (in-memory)?
A: tmpfs: /tmp — fast scratch space, lost on restart.

Q: Bind mount with consistency mode (macOS)?
A: volumes: - type: bind<br> source: ./src<br> target: /app/src<br> consistency: cached

Q: Anonymous volume?
A: volumes: - /var/lib/postgresql/data — Docker creates one; survives container restarts but not down -v.

Q: List all named volumes?
A: docker volume ls — Compose names them <project>_<volume>.

Q: Inspect a specific volume's host path?
A: docker volume inspect <name> — see Mountpoint.

Q: Restart policy "always" vs "on-failure"?
A: always restarts no matter what; on-failure[:N] restarts only on non-zero exit, optionally with retry cap.

Q: Best restart policy for dev?
A: restart: unless-stopped — survives reboots but lets you stop deliberately.

Q: Use a different Dockerfile per env?
A: build:<br> context: .<br> dockerfile: Dockerfile.prod

Q: Pass build args?
A: build:<br> args:<br> NODE_VERSION: 24 — referenced as ARG NODE_VERSION in Dockerfile.

Q: Multi-platform build via Compose?
A: build:<br> platforms: [linux/amd64, linux/arm64] (requires buildkit/buildx).

Q: Override service config per environment?
A: Use docker-compose.override.yml (auto-merged in dev) and -f docker-compose.yml -f docker-compose.prod.yml in prod.

Q: Order of file merge with multiple -f flags?
A: Later files override earlier ones; values merge deeply.

Q: Compose v2 vs v1 CLI?
A: v1 was docker-compose (Python); v2 is docker compose (Go plugin) — same syntax, better perf.

Q: What does docker compose config do?
A: Validates and prints the fully resolved Compose file with env interpolation applied.

Q: What does docker compose top show?
A: Running processes inside each service's container.

Q: What does docker compose events do?
A: Streams container lifecycle events (start/die/kill) — useful when debugging restarts.

Q: Force-recreate containers without rebuilding image?
A: docker compose up -d --force-recreate

Q: Recreate only one service?
A: docker compose up -d --force-recreate web

Q: Remove only stopped containers from a project?
A: docker compose rm -f

Q: Set Compose project to use a specific working dir?
A: --project-directory PATH or env COMPOSE_PROJECT_DIR.

Q: Combine multiple files using COMPOSE_FILE env?
A: COMPOSE_FILE=base.yml:override.yml (colon-separated; semicolon on Windows).

Q: Set the default platform for all services?
A: services:<br> web:<br> platform: linux/amd64 (or env DOCKER_DEFAULT_PLATFORM).

Q: Use a specific user inside container?
A: user: '1000:1000' — avoids root-owned files when bind-mounting source.

Q: Mount user's UID into container automatically?
A: user: "${UID}:${GID}" in compose + export UID/GID in shell or .env.

Q: Add capabilities to a container?
A: cap_add: [NET_ADMIN, SYS_PTRACE] — minimize for security; drop with cap_drop: [ALL].

Q: Run container with privileged mode?
A: privileged: true — almost never needed; equivalent to bypassing many security controls.

Q: Add a hostname alias?
A: aliases: under network membership, or extra_hosts: ['api.local:127.0.0.1'].

Q: DNS configuration?
A: dns: [8.8.8.8, 1.1.1.1] — useful behind corporate DNS that can't resolve public hosts.

Q: Compose interpolation default value?
A: ${VAR:-default} — used if VAR is unset or empty.

Q: Strict interpolation (fail if unset)?
A: ${VAR:?error message} — Compose errors out if VAR isn't set.

Q: Inject literal $ in compose values?
A: Escape with $$.

Q: Define a config file mounted to multiple services?
A: configs:<br> app_config:<br> file: ./app.conf; reference under each service.

Q: Read secret value inside container?
A: Secret is mounted at /run/secrets/<name> as a file — never an env var.

Q: Limit log size to avoid disk fill?
A: logging:<br> driver: json-file<br> options:<br> max-size: '10m'<br> max-file: '3'

Q: Send container logs to syslog?
A: logging:<br> driver: syslog<br> options:<br> syslog-address: 'tcp://localhost:514'

Q: Send container logs to fluentd?
A: logging:<br> driver: fluentd<br> options:<br> fluentd-address: 'localhost:24224'<br> tag: web

Q: Best way to inspect what env vars are set inside a running container?
A: docker compose exec web env | sort

Q: Run a shell in a running container?
A: docker compose exec web sh (or bash if installed).

Q: Exec as root inside container running as non-root?
A: docker compose exec --user root web sh

Q: Copy file out of a running container?
A: docker compose cp web:/etc/nginx/nginx.conf ./nginx.conf

Q: Copy file into a running container?
A: docker compose cp ./file.txt web:/data/file.txt

Q: View ports actually mapped on host?
A: docker compose port web 80

Q: Pause/unpause a service?
A: docker compose pause web and docker compose unpause web — process is suspended via SIGSTOP.

Q: Get top processes by CPU/memory?
A: docker stats $(docker compose ps -q)

Q: Real-time resource monitor?
A: docker compose stats — Compose v2 shortcut.

Q: Show service config interpolated?
A: docker compose config --services lists service names; without flags prints full config.

Q: Set replicas count declaratively?
A: deploy:<br> replicas: 3 — only used by Swarm; for local Compose use up --scale.

Q: Use environment from inherited shell variables?
A: environment: - HOME (no value) — Compose pulls from host env.

Q: Order of env precedence?
A: CLI -e > environment: > env_file: > shell env > Dockerfile ENV.

Q: Healthcheck retries default?
A: 3 retries, 30s interval, 30s timeout, 0s start_period — tune for slow-starting DBs.

Q: Start period in healthcheck?
A: start_period: 30s — initial grace where failures don't count toward unhealthy.

Q: Difference between exited and dead container?
A: Exited: stopped normally.
Dead: stopped abnormally (process killed by OOM, daemon failure).

Q: Detect OOM kills?
A: docker inspect <id> | grep -i oomkilled — true if kernel OOM killer triggered.

Q: Avoid OOM kills?
A: Set deploy.resources.limits.memory realistically, or fix the memory leak in the app.

Q: Use a custom network driver (e.g., macvlan)?
A: networks:<br> mac:<br> driver: macvlan<br> driver_opts:<br> parent: eth0<br> ipam:<br> config:<br> - subnet: 192.168.1.0/24

Q: Compose IPv6 support?
A: networks:<br> ip6net:<br> enable_ipv6: true<br> ipam:<br> config:<br> - subnet: 2001:db8::/64

Q: Fixed IP for a service container?
A: networks:<br> backend:<br> ipv4_address: 172.20.0.10 (requires custom IPAM).

Q: Compose Swarm deploy section?
A: deploy.replicas, placement.constraints, restart_policy — ignored by Compose, used by Swarm.

Q: Run a service only manually (don't auto-start)?
A: profiles: [manual] — service starts only with --profile manual.

Q: Conditionally bring up dev tools?
A: profiles: [dev] on adminer/mailcatcher containers — keeps prod runs clean.

Q: Multiple profiles per service?
A: profiles: [dev, debug] — service starts if any matching profile is active.

Q: Postgres init script ordering?
A: Files in /docker-entrypoint-initdb.d/ run alphabetically — prefix with 01_, 02_ to control order.

Q: Postgres user/db env vars?
A: POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB — create on first run.

Q: MySQL equivalents?
A: MYSQL_ROOT_PASSWORD, MYSQL_DATABASE, MYSQL_USER, MYSQL_PASSWORD.

Q: Redis with appendonly persistence?
A: command: ['redis-server', '--appendonly', 'yes'] + volume on /data.

Q: Redis password?
A: command: ['redis-server', '--requirepass', '${REDIS_PASSWORD}']

Q: Mongo with auth?
A: Set MONGO_INITDB_ROOT_USERNAME and MONGO_INITDB_ROOT_PASSWORD — enables auth on first run.

Q: RabbitMQ default user?
A: guest/guest from localhost only; mount a definitions.json or use env vars for real creds.

Q: Elasticsearch single-node dev?
A: environment:<br> - discovery.type=single-node<br> - xpack.security.enabled=false

Q: Kafka in Compose (KRaft mode)?
A: environment: KAFKA_KRAFT_MODE: 'true' + a few KAFKA_* vars; bitnami images simplify this.

Q: Nginx serving a static SPA?
A: volumes: - ./dist:/usr/share/nginx/html:ro with a config that falls back to index.html for SPA routes.

Q: Traefik as reverse proxy?
A: Run traefik service, label app services with traefik.http.routers.web.rule=Host(`example.com`).

Q: Caddy auto-HTTPS in Compose?
A: Bind ports 80/443, mount Caddyfile, Caddy fetches Let's Encrypt cert automatically.

Q: Mailhog for catching dev emails?
A: mailhog/mailhog image, expose 1025 (SMTP) and 8025 (UI).

Q: Adminer for DB GUI?
A: adminer image on port 8080; connect using compose service name as host.

Q: Run periodic job in Compose?
A: Either a cron container, a service running its own scheduler, or an external cron + docker compose exec.

Q: Run a one-off init container that exits?
A: Service with restart: 'no'; depends_on can wait on it via condition: service_completed_successfully.

Q: Wait-for-service-completed?
A: depends_on:<br> migrate:<br> condition: service_completed_successfully

Q: Why "depends_on" alone isn't enough?
A: It only waits for the container to start, not for the service inside to be ready. Add healthcheck + service_healthy.

Q: Set CPU limit?
A: deploy.resources.limits.cpus: '0.5' — limits to half a core.

Q: Set memory limit?
A: deploy.resources.limits.memory: 512M — kernel kills if exceeded.

Q: Set memory reservation (soft)?
A: deploy.resources.reservations.memory: 256M — guaranteed minimum; not enforced limit.

Q: Compose with rootless Docker?
A: Works identically; DOCKER_HOST=unix:///run/user/$UID/docker.sock.

Q: Use Podman Compose?
A: podman-compose or podman compose (newer) reads docker-compose.yml with high compatibility.

Q: Limit container PIDs?
A: pid_limit: 200 — prevent fork-bomb-style runaway processes.

Q: Read-only root filesystem?
A: read_only: true — combine with tmpfs: for writable scratch dirs.

Q: Add an SBOM tag for compliance?
A: labels:<br> - 'org.opencontainers.image.source=...'

Q: Force a specific platform on Apple Silicon for amd64-only images?
A: platform: linux/amd64 — Rosetta emulates it.

Q: Override the user namespace?
A: userns_mode: 'host' or userns_mode: 'keep-id' on Podman.

Q: Compose with Buildkit cache mount?
A: Inside Dockerfile: RUN --mount=type=cache,target=/root/.npm npm ci — Compose triggers this via build:.

Q: Use bake for multi-image builds?
A: docker buildx bake reads a Compose-style file (HCL or compose.yml) to build many images in parallel.

Q: Common cause of port conflict?
A: Another container, another Compose project, or a host process already binds the same port. Change host port: ports: - '8081:80'.

Q: Find what's binding a port?
A: macOS/Linux: sudo lsof -iTCP:8080 -sTCP:LISTEN or ss -ltn.

Q: Stop and remove containers but keep volumes?
A: docker compose down (no -v).

Q: Stop and remove containers + networks + volumes?
A: docker compose down -v --remove-orphans

Q: "Orphan containers detected" warning?
A: Containers from old service definitions still exist. Remove with --remove-orphans on up or down.

Q: Compose build cache invalidation issue?
A: A changed file outside the build context isn't seen; a COPY early in the Dockerfile invalidates everything after. Order layers carefully.

Q: Best practice: bind-mount node_modules?
A: Don't — instead use anonymous volume to hide host's node_modules: - /app/node_modules after - ./:/app.

Q: Hot-reload Node app in Compose?
A: Mount source with ./src:/app/src, run nodemon or framework dev server inside container.

Q: Hot-reload Vite in Compose?
A: vite --host 0.0.0.0 + ports + bind-mount source. May need polling: true in vite.config.js on macOS for file change detection.

Q: File-watching not working on macOS/WSL?
A: Bind-mounted FS doesn't fire inotify reliably. Use polling watchers or filesystem syncer (mutagen).

Q: Compose with WSL2?
A: Run from inside the Linux filesystem (/home/user/...) for best performance, not /mnt/c/.

Q: SQL dump from Postgres container?
A: docker compose exec db pg_dump -U postgres -d mydb > backup.sql

Q: Restore SQL dump into Postgres container?
A: docker compose exec -T db psql -U postgres -d mydb < backup.sql

Q: Live-tail logs of all services?
A: docker compose logs -f --tail=100

Q: Filter logs by service?
A: docker compose logs -f web db (multiple services as args).

Q: Color the log output?
A: Compose colors by default; --no-color to disable for piping.

Q: Set timestamps on log lines?
A: --timestamps flag on logs.

Q: Watch resource usage live?
A: docker compose stats or top-level docker stats.

Q: Limit container restart attempts?
A: restart_policy.max_attempts: 3 + restart: on-failure:3.

Q: Compose run with override for one variable?
A: docker compose run -e FOO=bar web command

Q: Run task with TTY (interactive)?
A: docker compose run --rm -it web bash — default is interactive; -T disables TTY.

Q: Mount user's SSH keys read-only for git in container?
A: volumes: - ~/.ssh:/home/node/.ssh:ro — security risk if image is shared.

Q: Multi-stage Dockerfile referenced from compose?
A: Compose passes through to buildkit; specify build stage target: build:<br> target: prod.

Q: Use buildkit cache from registry?
A: build:<br> cache_from: ['myregistry/web:cache'] + cache_to: in CI.

Q: What's the difference between Compose project and stack?
A: Compose project = local; Stack = Compose deployed to Swarm via docker stack deploy.

Q: Convert compose.yml to Kubernetes manifests?
A: Use kompose convert; review output, never deploy blindly.

Q: Migrate from Compose to Helm?
A: Compose handles dev nicely; Helm/Kustomize for prod. Keep compose.yml for local DX even after K8s adoption.

Q: Compose with Docker Desktop Kubernetes?
A: Compose stays local; Kubernetes runs separately. Compose doesn't deploy to K8s without conversion.

Q: Run Compose against a remote Docker host?
A: DOCKER_HOST=ssh://user@host docker compose up — uses SSH transport.

Q: Common cause: 'no matching manifest for linux/arm64'?
A: Image was built for amd64 only. Set platform: linux/amd64 or find an arm64-supporting tag.

Q: Strategy for slow first-time compose up?
A: Pre-build images in CI and pull from registry rather than rebuilding locally.

Q: Hidden cost of using latest tag?
A: Unrelated upstream changes can break your build. Pin to specific tags or digests.

Q: Pin to image digest?
A: image: nginx@sha256:abcd... — guaranteed identical bits.

Q: Discover the digest of a tag?
A: docker pull nginx:1.27 && docker inspect --format='{{index .RepoDigests 0}}' nginx:1.27

Q: Disable swap inside container?
A: Compose can't control container swap directly; pass to Docker via memswap_limit.

Q: Disable IPC namespace sharing?
A: ipc: 'private' — default in modern Docker.

Q: Share IPC with host (legacy apps)?
A: ipc: 'host' — security risk; avoid if possible.

Q: Use Docker secrets in dev?
A: Docker secrets only work with Swarm. In Compose, mount a gitignored file via secrets:<br> pwd:<br> file: ./pwd.txt

Q: Compose with Docker Hub rate limits?
A: Auth pulls with docker login; consider a registry mirror or cache image in CI.

Q: Use a private registry?
A: image: registry.example.com/my/web:1.0 — Docker uses ~/.docker/config.json credentials.

Q: Pull policy?
A: pull_policy: always|missing|never — controls when Compose pulls before running.

Q: Compose v2 watch mode?
A: docker compose watch — auto-rebuild/restart on file changes per x-develop.watch: rules.

Q: Watch sync action?
A: action: sync — copy changed files into running container.

Q: Watch rebuild action?
A: action: rebuild — full image rebuild on matching changes.

Q: Sample watch config?
A: x-develop:<br> watch:<br> - path: ./src<br> target: /app/src<br> action: sync

Q: Debug compose interpolation by printing one var?
A: docker compose config | grep MYVAR

Q: Pipe compose config into a temp env?
A: docker compose --env-file ./prod.env config

Q: Difference between .env file and env_file:?
A: .env auto-loaded for interpolation in compose.yml; env_file: populates env vars inside containers.

Q: COMPOSE_PROFILES env?
A: Activates one or more profiles without CLI flag: COMPOSE_PROFILES=dev,debug docker compose up.

Q: Service depends_on syntax with no condition?
A: depends_on: [db, redis] — short form; just affects start order, no health awareness.

Q: service_started condition?
A: depends_on:<br> db:<br> condition: service_started — same as short form; the default condition.

Q: Stop signal customization?
A: stop_signal: SIGINT — useful for apps that don't handle SIGTERM gracefully.

Q: Stop grace period?
A: stop_grace_period: 30s — waits before SIGKILL.

Q: Force-kill all containers in project?
A: docker compose kill — sends SIGKILL; kill -s SIGINT to send a different signal.

Q: Common rookie mistake with env vars containing $?
A: Unescaped $ triggers compose interpolation. Use $$ in compose.yml to escape.

Q: Common rookie mistake: secrets in image?
A: Never COPY .env into image; secrets become part of the layer history. Use runtime injection.

Q: Common rookie mistake: bind-mount overrides container content?
A: volumes: - .:/app over an image with /app/node_modules wipes them. Use anonymous volume to preserve.

Q: Healthy compose for Laravel app?
A: php-fpm + nginx + mysql + redis + queue worker; queue runs in its own service with the app image and php artisan queue:work.

Q: Healthy compose for Rails app?
A: web (puma) + sidekiq + postgres + redis + (optionally) chrome for system tests.

Q: Healthy compose for Django app?
A: gunicorn + celery worker + beat + postgres + redis + (optional) flower.

Q: Healthy compose for Next.js app?
A: next dev + postgres (+ redis for sessions) — anonymous volume on node_modules.

Q: Healthy compose for FastAPI?
A: uvicorn with --reload + postgres; mount source for hot reload.

Q: Healthy compose for monorepo?
A: Define a service per package needing isolation; share networks; use profiles to toggle subsets.

Q: GPU access (NVIDIA) in Compose?
A: deploy:<br> resources:<br> reservations:<br> devices:<br> - capabilities: [gpu]

Q: Compose with overlay file for CI?
A: docker compose -f docker-compose.yml -f docker-compose.ci.yml run --rm test

Q: Best dev compose practice for git collaboration?
A: Commit base docker-compose.yml; gitignore docker-compose.override.yml so each dev customizes.

Q: Detect Compose version?
A: docker compose version — should say v2.x+; v1 (Python) is end-of-life.

Q: Common cause of 'Cannot connect to the Docker daemon'?
A: Docker Desktop not running, or socket path wrong (Linux: sudo systemctl start docker; usermod -aG docker $USER for permissions).

Q: Cleanup unused everything?
A: docker system prune -a --volumes — careful; removes all unreferenced images, networks, volumes.

Q: Reuse a built image without rebuilding?
A: docker compose up --no-build

Q: Skip pulling images?
A: docker compose up --no-pull — uses local copy or fails.

Q: Verbose Compose output?
A: --verbose flag or COMPOSE_HTTP_TIMEOUT tuning for slow networks.

Q: Inspect compose project metadata?
A: docker compose ls — lists active projects.

Q: Run inside named project?
A: docker compose -p projname ps — useful when multiple Compose projects coexist.

Q: Idea: docker-in-docker for CI?
A: Bind-mount host's docker.sock or use docker:dind. dind is heavier but isolates the daemon.

Q: Common security note about docker.sock mount?
A: Mounting /var/run/docker.sock grants root-equivalent access on the host — avoid in untrusted environments.

Q: Use a build secret (BuildKit) in Dockerfile via Compose?
A: build:<br> secrets: [npm_token] + secrets:<br> npm_token:<br> file: ./npm_token — RUN with --mount=type=secret.

Q: Build-time env var only (not at runtime)?
A: Use ARG in Dockerfile + build.args in Compose, not ENV.

Q: Healthcheck disabling for one service?
A: healthcheck:<br> disable: true

Q: Compose with reload-on-change for Go binary?
A: Use air (or cosmtrek/air image) — watches source, rebuilds, restarts.

Q: Compose for Python with watchgod?
A: Run uvicorn app:app --reload or use watchexec/watchdog for non-ASGI apps.

Q: Common cause: bind mount empty inside container?
A: Path mismatch (host path doesn't exist, or relative path resolved from compose file dir, not where you ran docker compose).

Q: Test that volumes survive recreation?
A: docker compose down; docker compose up -d; docker compose exec db cat /var/lib/postgresql/data/postgresql.conf

Q: Find which compose file is being used?
A: docker compose config --services — works from where compose ran; pair with -f to verify.