Script to copy, compare or backup databases in postgresql
4.5K
Script to copy, compare or backup the content of postgresql databases. The TAG corresponds to the version of postgresql-client.
environment variables:
IP1=128.66.0.1
PORT1=5432
IP2=128.66.0.2
PORT2=5432
DBNAME=dbexample
USER1=admin
PASS1=123456
USER2=admin
PASS2=123456
[email protected]
MAILPASS=123456
MAILSERVER=smtp.mail.com
MAILPORT=456
[email protected]
[email protected]
docker run -it --rm --name comparedb --pull always -e IP1=128.66.0.1 -e PORT1=5432 -e IP2=128.66.0.2 -e PORT2=5432 -e DBNAME=dbexample -e USER1=admin -e PASS1=123456 -e USER2=admin -e PASS2=123456 sinfallas/comparar-db-docker:TAG comparardb
docker run -it --rm --name copydb --pull always -e IP1=128.66.0.1 -e PORT1=5432 -e IP2=128.66.0.2 -e PORT2=5432 -e DBNAME=dbexample -e USER1=admin -e PASS1=123456 -e USER2=admin -e PASS2=123456 sinfallas/comparar-db-docker:TAG copiardb
First place the information necessary to access the databases in the lista.txt file, then mount the folder that contains said file as a volume in /app.
docker run -it --rm --name backupdb --pull always --volume ./:/app sinfallas/comparar-db-docker:TAG backupdb
Example of lista.txt content
192.168.1.1 5432 user password example_db1
192.168.1.2 5432 user p4ssw0rd example_db2
NOTE: examples of the lista.txt file can be found in the github repository.
git: https://github.com/tecno-consultores/comparar-db-docker
Content type
Image
Digest
sha256:2e17038e6…
Size
95.6 MB
Last updated
6 months ago
docker pull sinfallas/comparar-db-docker