I am having trouble understanding how to get data to persist from a Docker container. Currently if I bring the container down/up I have to recreate the postgres database.
This is what I have to do currently:
sudo docker exec -it redash_postgres_1 pg_dump -U postgres -c postgres > ~/redash_backup.sql
sudo docker exec -i redash_postgres_1 psql -U postgres postgres < redash_backup.sql
Could anyone explain how the volume should be setup in the docker-compose.yml so I don’t have to dump and restore? It could be my novice understanding of Docker volumes… any best practice advice would be great, thanks!