'Unable to reach the database server using Prisma, Docker and NestJS

I'm following a tutorial on NestJS and it uses Docker to deploy the database (locally). I'm totally new with Docker by the way.

As an ORM, it uses Prisma.

My Docker container launches, "ready to accept connections", but when I do npx prisma migrate dev, it returns ->

Error: P1001: Can't reach database server at localhost:5434 Please make sure your database server is running at localhost:5434.

Here's the DATABASE_URL situated in a .env file (I added the connect_timeout after some searches on internet but it didn't solve the problem) :

DATABASE_URL="postgresql://postgres:123@localhost:5434/nest?schema=public?connect_timeout=300"

Here's my docker-compose.yml : docker-compose.yml



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source