I tried connecting my docker services, that is a Kotlin based SpringBootApplication with Postgres. I get a error saying password authentication failed for user "postgres"
and
Connection matched pg_hba.conf line 100: "host all all all scram-sha-256"
when I try running docker-compose file the docker-compose up --build
.
Error
docker-compose
I tried looking into solutions online, but wasn’t able to figure out.
env_file:
SPRING_DATASOURCE_USERNAME=postgres
SPRING_DATASOURCE_PASSWORD=root
SPRING_DATASOURCE_DBNAME=postgres
SPRING_DATASOURCE_DB_PORT=5432
SPRING_DATASOURCE_URL=r2dbc:postgresql://db:5432/postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=root
POSTGRES_DB=postgres
docker-compose:
version: "3"
services:
application:
build:
context: .
ports:
- "8080:8080"
env_file:
- ./.env
depends_on:
- db
networks:
- portal
db:
image: postgres:14.7-alpine
ports:
- "5432:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: root
POSTGRES_DB: postgres
volumes:
- ./postgres_data:/var/lib/postgresql/data
networks:
- portal
volumes:
postgres_data:
networks:
portal:
New contributor
Aniketh S Rai is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.