Home > Mobile >  Unable to reach the database server using Prisma, Docker and NestJS
Unable to reach the database server using Prisma, Docker and NestJS

Time:03-02

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.

So my Docker container is launched, "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

Feel free to ask if you need something else.

Thanks in advance!

CodePudding user response:

The postgres default port is 5432, not 5431. Try to change it in docker-compose.yml

  • Related