I’ve run into an issue where running migrations using the prisma framework, in an application container, against a postgres container, both in docker compose.
Running these migrations works ~10% of the time from within docker, failing non-deterministically with what looks like network errors, and works 100% of the time when running outside of docker against the db’s exposed port.
I’ve included a repo which you can pull. It includes instructions to reproduce (assuming a similar env).
The logs are probably unrelated to the issues I’m seeing. The migrations are small and fast, and should take < 1 second. All they’re doing is running this sql command, effectively.
Your config looks good to me. I could imagine an unlikely scenario where you attach other compose projects to the network of this one and at least one of them contains a service or container called “postgres” so using the hostname “postgres” would randomly point to a wrong Postgres database that doesn’t accept request on the excpected port.
I don’t think you did that, so I don’t know why the migration would not work. I don’t know Prisma, so if it is related to that, I can’t tell you.