Last active
May 12, 2023 09:12
-
-
Save rudyryk/ee0941269095a8b2f800cf9fa1ea3b1d to your computer and use it in GitHub Desktop.
Dump PostgresQL database via Docker
This file contains hidden or 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
#!/bin/sh | |
export DBUSER=postgres | |
export DBNAME=database | |
export DBHOST=localhost | |
export DBPORT=5432 | |
export DBOPTIONS= | |
export PGPASSWORD= | |
docker run --rm -e PGPASSWORD=${PGPASSWORD} postgres:latest pg_dump ${DBOPTIONS} \ | |
--host=${DBHOST} --port=${DBPORT} --username=${DBUSER} \ | |
--format=t --dbname=${DBNAME} | gzip > db-$(date +%Y-%m-%d).tar.gz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment