Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mikhail-angelov/4a60271764bc1a4aab06a2856a6e403f to your computer and use it in GitHub Desktop.
Save mikhail-angelov/4a60271764bc1a4aab06a2856a6e403f to your computer and use it in GitHub Desktop.
dump postgres db from docker
#on host
docker exec -i <docker postgres id> pg_dump -d postgresql://<db user>:<db password>@127.0.0.1:5432/<db name> > test.dump
#to run any sql script on postgres in docker
docker exec -i <docker postgres id> psql postgresql://<db user>:<db password>@127.0.0.1:5432/<db name> < test.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment