I'm running boot2docker on OSX 10.10. I have a database container set up so my databases don't get reset every time I start/stop a container. I would like to import a dump of a postgres database from heroku into my docker database. Is this possible to do?
I ended up finding this out with the help of a coworker. It's a little bit harder than just a regular old postgres database, but not much. This is based off this stackoverflow answer.
heroku pgbackups:urlpg: fig run db bashapt-get update && apt-get install curlcurl -o latest.dump [PASTE THE OUTPUT OF STEP 1 HERE]pg_restore --verbose --clean --no-acl --no-owner -h [YOUR BOOT2DOCKER IP] -U [YOUR_USERNAME] -d [DATABASE_NAME] latest.dumpAnd there you have it!
If the last step fails with some kind of invalid database error, double check latest.dump with head latest.dump. If you feel like your database is not downloading correctly, you may want to manually download it via the web gui and upload it to another host, like drop box. Then you would substitute step 1 with whatever url your dump can be found at.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With