I'm using docker to initiate a postgres db:
version: '3.8'
services:
postgres:
image: postgres:13
restart: always
environment:
POSTGRES_USER: db_user
POSTGRES_PASSWORD: db_password
volumes:
- postgres:/var/lib/postgresql/data
ports:
- '5432:5432'
volumes:
postgres:
and in my /.env file I have:
DATABASE_URL="postgresql://db_user:db_password@localhost:5432/college_db?schema=public"
I start docker:
PS C:\Users\alucardu\Documents\projects\**-react> docker-compose up -d
Starting **-react_postgres_1 ... done
Check if the server is running:
PS C:\Users\alucardu\Documents\projects\**-react> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e0f9233ce34b postgres:13 "docker-entrypoint.s…" 2 minutes ago Up 33 seconds 0.0.0.0:5432->5432/tcp, :::5432->5432/tcp **-react_postgres_1
But when I run a Prisma migrate I get an authentication error:
PS C:\Users\alucardu\Documents\projects\movieseat-react> npx prisma migrate dev --name "init"
Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Datasource "db": PostgreSQL database "college_db", schema "public" at "localhost:5432"
Error: P1000: Authentication failed against database server at `localhost`, the provided database credentials for `db_user` are not valid.
Please make sure to provide valid database credentials for the database server at `localhost`.
Why is Prisma not matching the set db_user and db_password to the environment variables created in the docker yml?
//edit.
I've added a college_db database and a superuser called db_user and made it owner of the college_db:
But I'm still getting the same error.
