Service names, Postgres healthchecks, a scheduler without a cache table, queues and migrations on deploy: the mistakes that show up when taking Laravel to Docker Compose and how to avoid them.
Taking a Laravel application to Docker Compose seems trivial until the first deployment fails for reasons that aren't in your code. These are five infrastructure mistakes I found while debugging real projects, with the symptom, the cause and the fix.
1. The Service Name Doesn't Match DB_HOST
Symptom: the application can't connect to the database: getaddrinfo failed , Connection refused or Name or service not known .
Cause: on a Compose network, containers are resolved by service name . If your service is called postgres in docker-compose.yml but the .env says DB_HOST=db , there's nothing to resolve.…