This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To backup: | |
docker exec -u <your_postgres_user> <postgres_container_name> pg_dump -Fc <database_name_here> > db.dump | |
To drop db (Don't do it on production, for test purpose only!!!): | |
docker exec -u <your_postgres_user> <postgres_container_name> psql -c 'DROP DATABASE <your_db_name>' | |
To restore: | |
docker exec -i -u <your_postgres_user> <postgres_container_name> pg_restore -C -d postgres < db.dump | |
working example for awx postgres database |