brunch
매거진 배포

도커 컨테이너 DB 접속

postgres

by 내가 사는 세상

환경변수 상태

POSTGRES_HOST=postgres

POSTGRES_PORT=5432

POSTGRES_DB=postgres-iintheworld-beta

POSTGRES_USER=jy9678

POSTGRES_PASSWORD=postgrespassword1234

DATABASE_URL=postgres://jy9678:postgrespassword1234@postgres:5432/postgres-iintheworld-beta


도커 컨테이너에서의 명령(리눅스)

ubuntu@ip-172-31-36-193:~$ sudo docker exec -it 2e27 /bin/bash

root@2e27e0dafb85:/# psql --username jy9678 --dbname postgres

postgres=# \connect postgres-iintheworld-beta

postgres-iintheworld-beta-# \dt

postgres-iintheworld-beta=# select * from accounts_user;


매거진의 이전글docker-compose, Dockerfile