You've already forked postgres
mirror of
https://github.com/docker-library/postgres.git
synced 2025-07-28 10:42:06 +03:00
Add new "docker-ensure-initdb.sh" script
This mimics the behavior of `docker-entrypoint.sh` before it starts the PostgreSQL server. It has three main goals/uses: 1. (most importantly) as an example of how to use "docker-entrypoint.sh" to extend/reuse the initialization behavior 2. ("docker-ensure-initdb.sh") as a Kubernetes "init container" to ensure the provided database directory is initialized; see also "startup probes" for an alternative solution (no-op if database is already initialized) 3. ("docker-enforce-initdb.sh") as part of CI to ensure the database is fully initialized before use (error if database is already initialized)
This commit is contained in:
@ -225,6 +225,7 @@ docker_setup_env() {
|
||||
: "${POSTGRES_HOST_AUTH_METHOD:=}"
|
||||
|
||||
declare -g DATABASE_ALREADY_EXISTS
|
||||
: "${DATABASE_ALREADY_EXISTS:=}"
|
||||
# look specifically for PG_VERSION, as it is expected in the DB dir
|
||||
if [ -s "$PGDATA/PG_VERSION" ]; then
|
||||
DATABASE_ALREADY_EXISTS='true'
|
||||
|
Reference in New Issue
Block a user