docker-compose up
To stop and remove all containers of the sample application run:
docker-compose down
To stop and remove all containers with Volume of the sample application run:
docker-compose down -v
- database (Created Default)- postgres
- username - postgres
- password - Passw0rd.
- port - 5432
- database (Created using Docker compose) - rajawat
- username - postgres
- password - Passw0rd.
- port - 5432
- Run the following command to open the pgsql client terminal
docker exec -it pg_container psql -h localhost -U postgres
- To See list of database:
\l
- Create database command
create database lks;
- Change database context command
\c lks
- List all tables in database
\dt
- Drop database command
drop database lks;
- To quit the database;
quit
- To Take the database backup;
pg_dump -U postgres "DbName" > dbbackup
or
pg_dump -U postgres "DbName" > dbbackup.sql
- To restore the database backup;
psql -U postgres "DbName" < dbbackup
or
psql -U postgres "DbName" < dbbackup.sql