How To Install and Run PostgreSQL using Docker ?
- Find the docker-container-id in which the postgres is running:
docker ps -a
- Enter into the container with the container ID:
docker exec -it <PSQL-Container-ID> bash
- Authenticate to start using as postgres user:
psql -h localhost -p 5432 -U postgres -W
- Enter the password used while creating the PSQL server container
\l
or\list
: list all databases\c
or\connect
: connect to the database\dt
: list all database tables\dt+
: list all database tables with information\d+ <table_name>
: show columns/data types from a specific table