Skip to content

initial user does not respect $POSTGRES_HOST_AUTH_METHOD=scram-sha-256 #726

Closed
@nicexe

Description

@nicexe

Here is how to replicate the issue.

docker-compose.yml:

version: '3.7'

services:
  database:
    image: postgres:12
    env_file: "./env/.env.db"
  db-test:
    image: postgres:12
    env_file: "./env/.env.db"

./env/.env.db:

POSTGRES_PASSWORD=pass
POSTGRES_USER=user
POSTGRES_DB=db
POSTGRES_HOST_AUTH_METHOD=scram-sha-256

Run docker-compose up -d and then docker-compose run db-test /bin/bash -c 'psql -d $POSTGRES_DB -U $POSTGRES_USER -h $DB_HOST'
Enter pass as your password.
It would fail.

Now modify ./env/.env.db as such:

POSTGRES_PASSWORD=pass
POSTGRES_USER=user
POSTGRES_DB=db
#POSTGRES_HOST_AUTH_METHOD=scram-sha-256

Run docker-compose down && docker-compose up -d and then docker-compose run db-test /bin/bash -c 'psql -d $POSTGRES_DB -U $POSTGRES_USER -h $DB_HOST' again.
Enter pass as your password.
This time it would succeed.

I purposely didn't persist any data for the database to start with a new clean environment on each try.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions