Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change PGDATA in 17+ to /var/lib/postgresql/MAJOR/docker #1259

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions 17/alpine3.19/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions 17/alpine3.20/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions 17/bookworm/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions 17/bullseye/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Dockerfile-alpine.template
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,20 @@ RUN set -eux; \

RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql

{{ if .major >= 17 then ( -}}
#
# NOTE: in 17+, PGDATA has changed to match the pg_ctlcluster standard directory structure, and the VOLUME has moved from /var/lib/postgresql/data to /var/lib/postgresql
#
ENV PGDATA /var/lib/postgresql/{{ .major | tostring }}/docker
RUN ln -svT . /var/lib/postgresql/data # https://github.com/docker-library/postgres/pull/1259#issuecomment-2215477494
VOLUME /var/lib/postgresql
# ("/var/lib/postgresql" is already pre-created with suitably usable permissions above)
{{ ) else ( -}}
ENV PGDATA /var/lib/postgresql/data
# this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
RUN install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA"
VOLUME /var/lib/postgresql/data
{{ ) end -}}

COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
RUN ln -sT docker-ensure-initdb.sh /usr/local/bin/docker-enforce-initdb.sh
Expand Down
10 changes: 10 additions & 0 deletions Dockerfile-debian.template
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,20 @@ RUN set -eux; \

RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql

{{ if .major >= 17 then ( -}}
#
# NOTE: in 17+, PGDATA has changed to match the pg_ctlcluster standard directory structure, and the VOLUME has moved from /var/lib/postgresql/data to /var/lib/postgresql
#
ENV PGDATA /var/lib/postgresql/{{ .major | tostring }}/docker
RUN ln -svT . /var/lib/postgresql/data # https://github.com/docker-library/postgres/pull/1259#issuecomment-2215477494
VOLUME /var/lib/postgresql
# ("/var/lib/postgresql" is already pre-created with suitably usable permissions above)
{{ ) else ( -}}
ENV PGDATA /var/lib/postgresql/data
# this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
RUN install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA"
VOLUME /var/lib/postgresql/data
{{ ) end -}}

COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
RUN ln -sT docker-ensure-initdb.sh /usr/local/bin/docker-enforce-initdb.sh
Expand Down
Loading