Notice
Recent Posts
Recent Comments
Link
250x250
«   2026/04   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30
Archives
Today
Total
관리 메뉴

DEV_Daniel

docker에 postgre 설치하기 본문

리눅스

docker에 postgre 설치하기

생활개발 2025. 8. 26. 11:19
728x90

https://hub.docker.com/에 들어가서 내가 원하는 버전 찾기

명령어docker pull postgres:16.9 복사해서 실행

이미지 확인

docker images

postgre 컨테이너 실행하기

docker run -p 5432:5432 -e POSTGRES_PASSWORD="{비밀번호}" --name {컨테이너명} postgres

내 비밀번호에 !가 들어가서 " -> ' 로 변경

 

실행중인 컨테이너 확인

docker ps

 

도커에 있는 postgre DB 사용하기

postgre 컨테이너 진입(대화형 bash쉘 진입)

docker exec --user="{실행할 사용자}" -it {컨테이너 name} "bash"

postgre 데이터 베이스 접속

psql -U postgres

psql: postgres DB에 접속하고 상호작용하기 위한 명령
-U postgres: 데이터베이스에 접속할 사용자를 postgres로 지정(postgres는 postgresDB 슈퍼 유저임)

 

728x90

'리눅스' 카테고리의 다른 글

리눅스 SELinux 비활성화  (0) 2026.02.11
Rocky리눅스 docker, docker compose 설치  (1) 2025.08.26
록키 리눅스 vim 설치  (1) 2025.07.24
리눅스 alias 무시하기  (0) 2024.08.20
리눅스 로그인 메시지 설정  (0) 2024.08.19