Skip to content

Instantly share code, notes, and snippets.

@muocod
Last active February 7, 2022 06:23
Show Gist options
  • Save muocod/50c3971102c8216942a3bcbd8d6a982b to your computer and use it in GitHub Desktop.
Save muocod/50c3971102c8216942a3bcbd8d6a982b to your computer and use it in GitHub Desktop.

Take postgresql backup from a docker container:

docker exec -it yourPostgresContainerNameOrHash pg_dump -U postgres -d yourDatabaseName > ./file.sql

It will take backup file called file.sql to host machine.

TAGS

take a database backup from postgresql using pg_dump in docker container

#docker #pg_dump #backup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment