Sign inSign up

lorn/pg_copy

By lorn

•Updated about 7 years ago

Docker image that copy data from DatabaseA to DatabaseB using pg_dump and psql

Image
0

183

lorn/pg_copy repository overview

⁠pg_copy

Docker image that copies data from DatabaseA to DatabaseB using pg_dump and psql

Basically, I do a pg_dump from DatabaseA and restore the dump, with psql on DatabaseB

⁠Environment Variables

The pg_copy image uses several environment variables which are easy to miss.

Warning: All the variables are required, the container wouldn't work without them

⁠POSTGRES_PASSWORD

⁠ENV

⁠POSTGRES_DB_A_DSN

The postgres DSN to the database that you want to copy

example:

 POSTGRES_DB_A_DSN: "postgresql://postgres:example@db:5432/postgres"
⁠POSTGRES_DB_B_DSN

The postgres DNS to the database that you want to load the data from POSTGRES_DB_A_DSN

example:

 POSTGRES_DB_B_DSN: "postgresql://postgres:example@db:5432/lorn"

⁠Test locally

If you want to test the pg_copy locally, you can use docker-compose:

Clone the repo and docker-compose run --service-ports pg_copy

You need to run docker-compose run two times because of the postgresql initialization bootstrap

Tag summary

Content type

Image

Digest

Size

80.3 MB

Last updated

about 7 years ago

docker pull lorn/pg_copy