I have the same problem than here and here, but not the same cause, I have no extra character in my password file.
I am working with odoo, Postgres and docker-compose. I want to use secrets for the database user and password but it does not work:
version: '2'
services:
db:
container_name: odoo_db
image: postgres:14
user: root
environment:
- POSTGRES_DB=postgres
- POSTGRES_USER=odoo
- POSTGRES_PASSWORD_FILE=/run/secrets/postgresql_password
volumes:
- ./postgresql:/var/lib/postgresql/data
secrets:
- postgresql_password
ports:
- 5432:5432
restart: always # run as a service
odoo15:
container_name: odoo_web
image: odoo:15
depends_on:
- db
user: root
volumes:
- ./addons:/mnt/extra-addons
- ./etc:/etc/odoo
ports:
- "10013:8069"
tty: true
command: --
environment:
- HOST=db
- USER=odoo
- PASSWORD_FILE=/run/secrets/postgresql_password
secrets:
- postgresql_password
restart: always # run as a service
secrets:
postgresql_password:
file: odoo_pg_pass
My password file odoo_pg_pass
contains only: 123 with no space and no CR or LF.
Here is the error message:
odoo_db | 2022-09-13 06:43:00.880 UTC [1058] FATAL: password authentication failed for user "odoo"
odoo_db | 2022-09-13 06:43:00.880 UTC [1058] DETAIL: Connection matched pg_hba.conf line 100: "host all all all scram-sha-256"
EDIT: if I suppress the secret file and use environment variable POSTGRES_PASSWORD
without _FILE
, it works with a password like odoo, but not with 123. I need more testing.
EDIT: more testing results: with odoo
as a pasword, the secret mechanism with use of the environment variable POSTGRES_PASSWORD_FILE
works, but not with another password. It is like if the password was hardcoded somewhere. But I have checked with a recursive grep and found nothing suspect in the whole tree.
EDIT: if I change the POSTGRES_USER
in db
and USER
in odoo15
to something different than odoo
, I have the same problem.