docker, postgres

Docker Postgres cheatsheet

Connecting to a Postgres database running inside a container:

From the box running the Postgres container, you first need to get into a terminal inside the container:

docker exec -i -t running_container_name /bin/bash

Opening the PSQL terminal once connected:

psql -U database_username_here

Listing all databases in the Postgres instance:

 \list 

Connect to a database:

 \connect database_name 

List all tables in a database:

 \dt  

Leave a Reply

Your email address will not be published. Required fields are marked *