Assumptions:
- Docker is installed
- Docker Compose is installed
Running the project
- Run the command
docker-compose up -d
. This will start a container calledmy_postgres
running in port5432
. - To SSH into the container, run
docker exec -it my_postgres psql -U postgres
. This command uses the defaultpostgres
user to log into the default databasepostgres
.
Basic Commands
- Create a new database
create database my_database
- List all databases
\l
- Connect to a particular database :
\c my_database
- Exit shell
\q