[docker] postgresSQL에서 FATAL: password authentication failed for 에러
2023. 9. 16. 01:35ㆍTrubleShooting
진행
docker-compose.yml 파일을 작성 후 docker-compose up -d
로 백그라운드에서 docker을 실행 후 DBeaver라는 툴에서 연결하려 했더니FATAL: password authentication failed for postgres
에러가 떴다..
# docker-compose.yml
version: '3.8'
services:
postgres:
# 사용할 docker 이미지 정의 (postgres 이미지의 13버전의 linux기반 경량 postgres 이미지)
image: postgres:13-alpine
restart: always
# 초기화 중에 컨테이너에 전달되는 환경 변수를 지정 (컨테이너가 사용할 사용자이름, 비밀번호 등)
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=1234
- POSTGRES_DB=test-db
# 호스트 파일 시스템에 데이터를 유지하는 데 사용
volumes:
- postgres:/var/lib/postgresql/data
# 호스트포트:컨테이너포트 형식 호스트 시스템의 포트를 컨테이너 5432 포트에 매핑
ports:
- '5432:5432'
volumes:
postgres:
이슈를 찾아보니 환경변수 떄문이었다.
몇 번을 docker-compose up -d를 하면서 동일한 컨테이너를 생성헀을 때 볼륨이 살아있었다.
docker-compose down -v
위 명령어로 볼륨을 초기화 후 다시 docker-compose up -d
로 실행해주니 정상적으로 실행 되었다.
'TrubleShooting' 카테고리의 다른 글
[NestJS] PartialType 사용시 Swagger 스키마 생성 안되는 현상 (0) | 2023.09.26 |
---|