how to backup postgres database in docker container code example
Example 1: pgrestore schema backup to a container
docker exec -i pg_container_name psql --username pg_username [--password pg_password] database_name < /path/on/your/machine/dump.sql
Example 2: backup postgres database docker
docker exec -t your-db-container pg_dumpall -c -U postgres > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql