Docker Compose advanced vocabulary

  • networks: — user-defined isolation; services communicate by name only within the same network
  • Named volume = Docker-managed persistent storage; bind mount = host directory mapped in
  • restart: unless-stopped — auto-restart on crash, but respects manual docker stop
  • healthcheck — periodic command probe; start_period gives app time to boot before failures count
  • depends_on: condition: service_healthy — waits for dependency's healthcheck to pass, not just container start

Question 0 of 5

What does the networks: section define in this docker-compose file?

services: api: image: myapp:latest networks: - frontend - backend db: image: postgres:16 networks: - backend nginx: image: nginx:alpine networks: - frontend networks: frontend: backend: