-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
Hello,
I am trying to connect a Django server to a PSQL database but it seems like the database is not created with the correct user in my docker-compose.yml
file. I get the following error:
gestion_materiel_tps-db-1 | 2023-03-06 08:19:53.351 UTC [70] FATAL: password authentication failed for user "postgres"
gestion_materiel_tps-db-1 | 2023-03-06 08:19:53.351 UTC [70] DETAIL: Role "postgres" does not exist.
gestion_materiel_tps-db-1 | Connection matched pg_hba.conf line 100: "host all all all scram-sha-256"
Here is my docker-compose.yml
:
version: "3"
services:
app:
build:
context: .
ports:
- 80:80
- 443:443
command:
/opt/app/start-server.sh
environment:
- DB_HOST=db
- DB_NAME=database_gestion_tps
- DB_USER=postgres_user
- DB_PASS=*
depends_on:
- db
db:
image: postgres:13-alpine
environment:
- POSTGRES_DB=database_gestion_tps
- POSTGRES_USER=postgres_user
- POSTGRES_PASSWORD=*
ports:
- "5432:5432"
volumes:
- db_gestion_tps:/var/lib/postgresql/data
As I used the POSTGRES_USER
variable in the environment
section, I expected the database to be created with the postgres_user
user but if we look at the log from docker compose up
, we can see that it is owned by the postgres
user:
gestion_materiel_tps-db-1 | The files belonging to this database system will be owned by user "postgres".
gestion_materiel_tps-db-1 | This user must also own the server process.
gestion_materiel_tps-db-1 |
gestion_materiel_tps-db-1 | The database cluster will be initialized with locale "en_US.utf8".
gestion_materiel_tps-db-1 | The default database encoding has accordingly been set to "UTF8".
gestion_materiel_tps-db-1 | The default text search configuration will be set to "english".
gestion_materiel_tps-db-1 |
gestion_materiel_tps-db-1 | Data page checksums are disabled.
Could you please help me with this?
FIREMarcoGraziano
Metadata
Metadata
Assignees
Labels
No labels