P
Prisma•5mo ago
jsoneaday

Docker error Can't reach database server at localhost:5432

I'm using docker compose and my server api depends on a postgres server in the same container. During the build I run
prisma migrate deploy
prisma migrate deploy
and get this error. I also tried replacing localhost with 0.0.0.0 and db (my database's docker service name) but it does not work. Strangely from my dev machine I'm able to run
prisma migrate dev --name init
prisma migrate dev --name init
without issue using this same DATABASE_URL variable.
DATABASE_URL="postgresql://freeauth:freeauth@localhost:5432/freeauth?schema=public"
DATABASE_URL="postgresql://freeauth:freeauth@localhost:5432/freeauth?schema=public"
4 Replies
jsoneaday
jsoneaday•5mo ago
Note also I am able to run
prisma generate
prisma generate
without issue from docker
RaphaelEtim
RaphaelEtim•5mo ago
Hi @jsoneaday 👋 Can you please share the content of your docker-compose.yml file?
jsoneaday
jsoneaday•5mo ago
I moved my prisma code from the docker run command into cmd and it worked. Thank you
RaphaelEtim
RaphaelEtim•5mo ago
Thank you for sharing the solution.
Want results from more Discord servers?
Add your server