postgre docker-compose.yml로 사용하기

송인성·2021년 10월 24일
0

docker-compose.yml을 사용하지 않을 경우에는 아래와 같이 매번 코드를 작성하면된다.

$ docker run -p 5432:5432 --name postgres -e POSTGRES_PASSWORD=1q2w3e4r -d postgres

docker-compose.yml 파일에 아래와 같이 코드를 작성한다.

postgres:
  image: postgres:11.10-alpine
  container_name: postgres
  hostname: postgres
  ports:
    - 5432:5432
  restart: always
  environment:
    - POSTGRES_USER=postgres
    - POSTGRES_PASSWORD=postgres
profile
코드 한줄에 의미를 생각할 수 있는 개발자가 되어 가는중... 🧑🏻‍💻

0개의 댓글