Inflearn brand logo image

Inflearn Community Q&A

manage4914's profile image
manage4914

asked

Node and React series that you can learn by following - Creating a Reddit site (NextJS) (Pages Router)

Running Postgres with Docker

postgres 에러 문의

Written on

·

1.5K

0

reddit-postgres | Error: Database is uninitialized and superuser password is not specified.

reddit-postgres | You must specify POSTGRES_PASSWORD to a non-empty value for the

reddit-postgres | superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run".

reddit-postgres |

reddit-postgres | You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all

reddit-postgres | connections without a password. This is not recommended.

reddit-postgres |

reddit-postgres | See PostgreSQL documentation about "trust":

reddit-postgres | https://www.postgresql.org/docs/current/auth-trust.html

이 오류가 계속 뜨고, data폴더는 생성 되지만

안에 내용이 없습니다.

volumes:
  data:

이 두줄을 추가해도 내용이 나오지 않습니다.

POSTGRES_USER: "${DB_USER_ID}"
POSTGRES_PASSWORD: "${DB_USER_PASSWORD}"

환경에 두줄 추가 해줬더니 data 폴더 내에 내용은 제대로 생성 된 것 같으나 이 방법은 좋지 않은 것 같습니다.

어떻게 해결해야 좋을지 궁금합니다.

 

 

클론코딩Next.jsnodejsreactdockerpostgresqltypescript

Answer 1

0

johnahn님의 프로필 이미지
johnahn
Instructor

안녕하세요

지금 문제는 data 폴더 안에 데이터가 자동으로 안들어가는 것 인거 같은데
Docker Desktop 실행해서

image이거를 아예 지우고

image 부분을
postgres:14.1-alpine
이걸로 바꿔서 사용해보시겠어요 ?

그리고 이 방법은
POSTGRES_USER: "${DB_USER_ID}" POSTGRES_PASSWORD: "${DB_USER_PASSWORD}"

https://hub.docker.com/_/postgres
공식 사이트에서 소개해준 방법이기에 사용하셔도 괜찮습니다 ~

manage4914's profile image
manage4914

asked

Ask a question