Skip to content

Conversation

md5
Copy link
Contributor

@md5 md5 commented Aug 26, 2015

As it now stands the $POSTGRES_USER and $POSTGRES_DB variables aren't visible in /docker-entrypoint-initdb.d/*.sh scripts unless they have been set explicitly with -e in the docker run command or with ENV in a derived Dockerfile.

This change allows those variables to be seen in the *.sh scripts. Without this change, any *.sh scripts that want to follow the same conventions as the postgres base image need to duplicate this code:

: ${POSTGRES_USER:=postgres} : ${POSTGRES_DB:=$POSTGRES_USER}

I ran into this while trying to implement postgis/docker-postgis#4 (Enable PostGIS extensions on default database).

Allows them to be used from /docker-entrypoint-initdb.d/*.sh scripts
@tianon
Copy link
Member

tianon commented Aug 26, 2015

Good call; LGTM 👍

@yosifkit
Copy link
Member

LGTM

yosifkit added a commit that referenced this pull request Aug 26, 2015
Export POSTGRES_USER and POSTGRES_DB vars in entrypoint
@yosifkit yosifkit merged commit 87b8be7 into docker-library:master Aug 26, 2015
@md5 md5 deleted the export-entrypoint-vars branch August 26, 2015 16:10
tianon added a commit to infosiftr/stackbrew that referenced this pull request Aug 26, 2015
- `mariadb`: fix `MYSQL_ALLOW_EMPTY_PASSWORD` feature (MariaDB/mariadb-docker#19) - `mongo`: 3.1.7 - `percona`: fix `MYSQL_ALLOW_EMPTY_PASSWORD` feature (docker-library/percona#8) - `postgres`: export `POSTGRES_USER` and `POSTGRES_DB` for initdb scripts (docker-library/postgres#84)
RichardScothern pushed a commit to RichardScothern/official-images that referenced this pull request Jun 14, 2016
- `mariadb`: fix `MYSQL_ALLOW_EMPTY_PASSWORD` feature (MariaDB/mariadb-docker#19) - `mongo`: 3.1.7 - `percona`: fix `MYSQL_ALLOW_EMPTY_PASSWORD` feature (docker-library/percona#8) - `postgres`: export `POSTGRES_USER` and `POSTGRES_DB` for initdb scripts (docker-library/postgres#84)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants