This section explains how to set up persistent database in docker container. To find the more info about it, please visit official postgres docker page.
After installing docker and starting it, we will have to download postgres docker container. We'll use alpine version: docker pull postgres:alpine
.
Under docker-postgres-scripts
you will find commands on how to:
- Start postgres container (
postgres_docker_start.sh
) First, it creates new volume, calledpostgres-psz
in order to have database data saved when you stop the container and then it creates new containerpostgres-psz
running onport 4321
and mounting previously created volumepostgres-psz
to/var/lib/postgresql/data
. - Stop the container (
postgres_docker_stop.sh
). - Remove the container (
postgres_container_remove.sh
). - Backup up the table
properties
containing scraped realestate data (postgres_container_backup.sh
).