- What is the depends_on limitation and how to work around it?
- depends_on: [db] ensures the db container starts before the app container, but does not wait for the database to be ready to accept connections. The fix: add a healthcheck to the db service and set depends_on condition: service_healthy in the app service.
- What is the difference between COPY and volume in Compose?
- COPY in a Dockerfile embeds files into the image at build time. Volumes in Compose mount host directories or named volumes into the container at runtime. Use volumes for development (code changes reflect without rebuilding); use COPY for production images.
- What version of the compose file format should I use?
- Docker Compose v2 deprecated the version key — you no longer need 'version: 3'. Old v2/v3 syntax still works, but the format is unified in the current spec. Remove the version key for new files and use the current Compose Specification.