docker-library / postgres

Docker Official Image packaging for Postgres
http://www.postgresql.org
MIT License
2.14k stars 1.11k forks source link

Change hard code to environment variables on VOLUME #1239

Closed balinorLiang closed 1 month ago

balinorLiang commented 1 month ago

I find that, we have ENV PGDATA before VOLUME, so I think it's better to use $PGDATA instead of /var/lib/postgresql/data

LaurentGoderre commented 1 month ago

VOLUME is a build time directive. Changing the env at runtime won't change the volume.

yosifkit commented 1 month ago

VOLUME is a build time directive. Changing the env at runtime won't change the volume.

Agreed. We wouldn't want a user seeing $PGDATA as the volume declaration in the Dockerfile and thinking that changing it at runtime will affect it.

balinorLiang commented 1 month ago

Oh, okay, I will close it. Thanks for your explanation @LaurentGoderre and @yosifkit