Run Postgres container with initial data fetched from remote url. This is fork of the official postgres:alpine.
docker build -t postgres-remote-initdb .
docker run --rm -it -p 5432:5432 \
-e SRC_URL="http://sql.service.consul/dump" \
-e ON_ERROR_STOP=0 \
-e POSTGRES_PASSWORD=aaa \
-e POSTGRES_DB=aaa \
-e POSTGRES_USER=aaa \
-e PGDATA=/var/lib/postgresql/data/pgdata \
-v postgres_data:/var/lib/postgresql/data/pgdata \
postgres-remote-initdb
Variables:
SRC_URL
- URI of server that returns sql dumpON_ERROR_STOP
- psql's ON_ERROR_STOP variable, default is 0POSTGRES_PASSWORD
- same as in official imagePOSTGRES_DB
- same as in official imagePOSTGRES_USER
- same as in official imagePGDATA
- same as in official image