Skip to content

Instantly share code, notes, and snippets.

@sergray
Created December 6, 2018 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergray/4b6f13c2f92395b8dec3c31ba86389f7 to your computer and use it in GitHub Desktop.
Save sergray/4b6f13c2f92395b8dec3c31ba86389f7 to your computer and use it in GitHub Desktop.
dump postgresql DB with specific pg_dump version running in Docker container
#!/bin/bash
pg_version=10.5 pg_user=user db_name=db && \
docker run -it --rm -v /tmp/pgdump:/tmp/pgdump:rw --network=host postgres:$pg_version \
pg_dump -h localhost -U $pg_user -W -f /tmp/pgdump/${db_name}_$(date +%Y%m%d%H%M%S) -Fc -v $db_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment