left is my docker-compose.yml and right that my docker is up and still I cannot access the database.
Can you tell me how can I alternately connect to the postgres database in docker (remember I am using Windows 11 OS)
version: '3.8'
services:
dev-db :
image : postgres:13
ports :
- "5434"
environment :
POSTGRES_USER : postgres
POSTGRES_PASSWORD : eresto
POSTGRES_DB : eresto
networks :
- 4s
networks:
4s:
C:UserssrikaTestProgramsE-Restoe-resto-api>npx prisma migrate dev
Environment variables loaded from .env
Prisma schema loaded from prismaschema.prisma
Datasource "db": PostgreSQL database "eresto", schema "public" at "localhost:5434"
Error: P1001: Can’t reach database server at localhost
:5434
Please make sure your database server is running at localhost
:5434
.
2
Answers
at ports "5432:5432" worked for me.
What the concept is, to expose the localhost server and put the ports in string.
You have not exposed the database on your host machine.
Please set the ports like this in your
docker-compose.yml
file: