Redash Docker Data Persitance - Volume Configuration

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:
backup:
sudo docker exec -it redash_postgres_1 pg_dump -U postgres -c postgres > ~/redash_backup.sql

restore:
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!

You can modify the REDASH_DATABASE_URL of the docker-compos.yml file to specify postgres database in a non-docker environment ,so that you only need executed the command to initialize the database at the first time

1 Like