IT

postgresql docker-compose.yml 설정

프로개발러 2022. 11. 24. 17:20
반응형

postgres의 기본 포트는 5432이다.

5432포트가 55432포트로 포팅된다.

 

 

docker-compose.yml 

version: '3.3'
services:
  postgres-db:
    image: postgres:14.1
    container_name: postgres
    ports:
      - "55432:5432"
    volumes:
      - ./data/postgresql:/var/lib/postgresql/data
    restart: always
    environment:
      POSTGRES_USER: user_id
      POSTGRES_PASSWORD: user_password
      POSTGRES_DB: user_db
    healthcheck:
      test: ["CMD", "pg_isready", "-U", "Dev"]
    networks:
      - net-postgres
networks:
  net-postgres:

 

docker-compose up -d 명령어를 통해서 postgresql 실행하면 됨.

 

반응형