Skip to content

Instantly share code, notes, and snippets.

View guisea's full-sized avatar

Aaron Guise guisea

  • Hamilton, New Zealand
  • 06:31 (UTC +13:00)
View GitHub Profile
@guisea
guisea / postgres.docker.backup.txt
Last active August 27, 2020 17:56 — forked from narankhetani/postgres.docker.backup.txt
How to backup a AWX postgres database in docker.
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