Skip to content

Instantly share code, notes, and snippets.

@locofocos
Created December 1, 2017 05:24
Show Gist options
  • Save locofocos/badd43131f14b3e40c760741d5a26471 to your computer and use it in GitHub Desktop.
Save locofocos/badd43131f14b3e40c760741d5a26471 to your computer and use it in GitHub Desktop.
Import Heroku Backup, Local Docker Postgres DB, Windows 10 Home
# OS - Windows 10 Home (which requires Docker Toolbox since it doesn't support Hyper-V)
# Backup was generated from Heroku (which uses pg_dump)
# Backup location: C:\Users\Patrick\Desktop\tmp\latest.dump (change accordingly below)
# Docker image - https://hub.docker.com/_/postgres/
docker run --name some-postgres -v //c/Users/Patrick/Desktop/tmp:/hostfiles/ -e POSTGRES_PASSWORD=password -d postgres
docker exec -it some-postgres pg_restore -U postgres -d postgres -1 /hostfiles/latest.dump
# Error. Copy the role name.
# like qwerasdfqwerasdf
docker run -it --rm --link some-postgres:postgres postgres psql -h postgres -U postgres
# Type "password"
CREATE ROLE qwerasdfqwerasdf;
\q
docker exec -it some-postgres pg_restore -U postgres -d postgres -1 /hostfiles/latest.dump
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment