Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bigsnarfdude/c7176b22b528ba32638c5ff898a945b5 to your computer and use it in GitHub Desktop.
Save bigsnarfdude/c7176b22b528ba32638c5ff898a945b5 to your computer and use it in GitHub Desktop.
You need to restore a PostgreSQL dump to your Docker container. Here's how to do it:
1. First, make sure you're working with the correct database container (`wsdb-upgrade`) which is running PostgreSQL 13.1
2. Use the `docker exec` command to pipe the dump file into the `psql` command inside the container:
```bash
cat workshops_staging.dump | docker exec -i wsdb-upgrade psql -U postgres -d workshops
```
If you need to specify a different user or database name, you can adjust the command accordingly. For example:
```bash
cat workshops_staging.dump | docker exec -i wsdb-upgrade psql -U your_username -d workshops
```
If you encounter permission issues or errors, you might need to:
1. First copy the dump file into the container:
```bash
docker cp workshops_staging.dump wsdb-upgrade:/tmp/
```
2. Then restore from within the container:
```bash
docker exec -it wsdb-upgrade psql -U postgres -d workshops -f /tmp/workshops_staging.dump
```
Would you like me to explain more about any part of this process?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment