인프런 커뮤니티 질문&답변

jurjur님의 프로필 이미지
jurjur

작성한 질문수

[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - NestJS Core

Docker Compose 파일 작성해보기

docker-compose up 이후 shut down 로그가 나오며 postgres-data에 데이터가 생성되지 않습니다.

작성

·

278

0

안녕하세요.
강의 보면서 docker-compose 파일 만들고 실행하다가 막히는 부분이 있어 질문드립니다.

  • os

    • ubuntu 20.04

  • docker version

    • Docker version 24.0.2, build cb74dfc

       

  • docker-compose file

services:
  postgres:
    image: postgres:15
    restart: always
    volumes:
      - ./postgres-data:/var/lib/postgresql/data
    ports:
      - '5432:5432'
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: postgres
  • terminal log

[+] Running 1/0
 ✔ Container nestjs_sns_server-postgres-1  Created                                                                                                  0.0s 
Attaching to nestjs_sns_server-postgres-1
nestjs_sns_server-postgres-1  | The files belonging to this database system will be owned by user "postgres".
nestjs_sns_server-postgres-1  | This user must also own the server process.
nestjs_sns_server-postgres-1  | 
nestjs_sns_server-postgres-1  | The database cluster will be initialized with locale "en_US.utf8".
nestjs_sns_server-postgres-1  | The default database encoding has accordingly been set to "UTF8".
nestjs_sns_server-postgres-1  | The default text search configuration will be set to "english".
nestjs_sns_server-postgres-1  | 
nestjs_sns_server-postgres-1  | Data page checksums are disabled.
nestjs_sns_server-postgres-1  | 
nestjs_sns_server-postgres-1  | fixing permissions on existing directory /var/lib/postgresql/data ... ok
nestjs_sns_server-postgres-1  | creating subdirectories ... ok
nestjs_sns_server-postgres-1  | selecting dynamic shared memory implementation ... posix
nestjs_sns_server-postgres-1  | selecting default max_connections ... 100
nestjs_sns_server-postgres-1  | selecting default shared_buffers ... 128MB
nestjs_sns_server-postgres-1  | selecting default time zone ... Etc/UTC
nestjs_sns_server-postgres-1  | creating configuration files ... ok
nestjs_sns_server-postgres-1  | running bootstrap script ... ok
nestjs_sns_server-postgres-1  | performing post-bootstrap initialization ... ok
nestjs_sns_server-postgres-1  | syncing data to disk ... ok
nestjs_sns_server-postgres-1  | 
nestjs_sns_server-postgres-1  | 
nestjs_sns_server-postgres-1  | Success. You can now start the database server using:
nestjs_sns_server-postgres-1  | 
nestjs_sns_server-postgres-1  |     pg_ctl -D /var/lib/postgresql/data -l logfile start
nestjs_sns_server-postgres-1  | 
nestjs_sns_server-postgres-1  | initdb: warning: enabling "trust" authentication for local connections
nestjs_sns_server-postgres-1  | initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.
nestjs_sns_server-postgres-1  | waiting for server to start....2024-01-17 13:05:30.755 UTC [49] LOG:  starting PostgreSQL 15.5 (Debian 15.5-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
nestjs_sns_server-postgres-1  | 2024-01-17 13:05:30.760 UTC [49] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
nestjs_sns_server-postgres-1  | 2024-01-17 13:05:30.777 UTC [52] LOG:  database system was shut down at 2024-01-17 13:05:30 UTC
nestjs_sns_server-postgres-1  | 2024-01-17 13:05:30.786 UTC [49] LOG:  database system is ready to accept connections
nestjs_sns_server-postgres-1  |  done
nestjs_sns_server-postgres-1  | server started

...

nestjs_sns_server-postgres-1  | 
nestjs_sns_server-postgres-1  | 2024-01-17 13:30:30.440 UTC [1] LOG:  starting PostgreSQL 15.5 (Debian 15.5-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
nestjs_sns_server-postgres-1  | 2024-01-17 13:30:30.440 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
nestjs_sns_server-postgres-1  | 2024-01-17 13:30:30.440 UTC [1] LOG:  listening on IPv6 address "::", port 5432
nestjs_sns_server-postgres-1  | 2024-01-17 13:30:30.450 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
nestjs_sns_server-postgres-1  | 2024-01-17 13:30:30.463 UTC [29] LOG:  database system was shut down at 2024-01-17 13:30:21 UTC
nestjs_sns_server-postgres-1  | 2024-01-17 13:30:30.473 UTC [1] LOG:  database system is ready to accept connections
nestjs_sns_server-postgres-1  | 2024-01-17 13:30:33.019 UTC [1] LOG:  received fast shutdown request
nestjs_sns_server-postgres-1  | 2024-01-17 13:30:33.024 UTC [1] LOG:  aborting any active transactions
nestjs_sns_server-postgres-1  | 2024-01-17 13:30:33.025 UTC [1] LOG:  background worker "logical replication launcher" (PID 32) exited with exit code 1
nestjs_sns_server-postgres-1  | 2024-01-17 13:30:33.025 UTC [27] LOG:  shutting down
nestjs_sns_server-postgres-1  | 2024-01-17 13:30:33.030 UTC [27] LOG:  checkpoint starting: shutdown immediate
nestjs_sns_server-postgres-1  | 2024-01-17 13:30:33.063 UTC [27] LOG:  checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.011 s, sync=0.005 s, total=0.038 s; sync files=2, longest=0.003 s, average=0.003 s; distance=0 kB, estimate=0 kB
nestjs_sns_server-postgres-1  | 2024-01-17 13:30:33.069 UTC [1] LOG:  database system is shut down

(1만자 이하로 작성해야 해서 로그는 중간 생략하였습니다.)

docker-comopse 파일이 정상적으로 실행이 되고 있는 상황인데 Postgresql 데이터 베이스 연결하면서 문제가 발생하고 있는것 같습니다.
프로젝트 폴더의 postgres-data폴더에도 postgresql 데이터가 생성되지 않았구요.

혹시 제가 잘못하고 있는 부분이 있을까요..?

답변 1

0

코드팩토리님의 프로필 이미지
코드팩토리
지식공유자

안녕하세요!

이건 처음보는 상황이네요.

저희 카카오채널로 오셔서 원격 신청해주시면 직접 봐드리겠습니다.

https://links.codefactory.ai

감사합니다!

jurjur님의 프로필 이미지
jurjur

작성한 질문수

질문하기