-
[PostgresSQL][Docker] 도커에 PostgresSQL DB 설치하기Linux/Tools 2024. 8. 8. 07:31
도커 허브 : posgresSQL
postgres - Official Image | Docker Hub
Note: the description for this image is longer than the Hub length limit of 25000, so has been trimmed. The full description can be found at https://github.com/docker-library/docs/tree/master/postgres/README.md. See also docker/hub-feedback#238 and d
hub.docker.com
1. PostgresSQL 이미지 가져오기
docker pull postgres
2. 실행하기
docker run --name postgres-db \ -e POSTGRES_PASSWORD=mysecretpassword \ -e TZ=Asia/Seoul \ -v /home/postgresql/data:/var/lib/postgresql/data \ -d postgres
- --name : 도커 컨테이너 이름
- -e POSTGRES_PASSWORD : DB 암호
- -e TZ : 타임존
- -v : 볼륨 마운트
2.1 비밀번호 숨기기
$ docker run --name some-postgres -e POSTGRES_PASSWORD_FILE=/run/secrets/postgres-passwd -d postgres