You've already forked postgres
mirror of
https://github.com/docker-library/postgres.git
synced 2025-07-25 12:22:02 +03:00
Use "/var/run/postgresql" consistently (and apply Debian's change of the default socket path to Alpine also)
This commit is contained in:
@ -54,10 +54,11 @@ RUN mv -v /usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample /usr/share/post
|
||||
&& ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
|
||||
&& sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample
|
||||
|
||||
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
|
||||
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod g+s /var/run/postgresql
|
||||
|
||||
ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
|
||||
ENV PGDATA /var/lib/postgresql/data
|
||||
RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 700 "$PGDATA"
|
||||
VOLUME /var/lib/postgresql/data
|
||||
|
||||
COPY docker-entrypoint.sh /
|
||||
|
@ -55,6 +55,11 @@ RUN set -ex \
|
||||
zlib-dev \
|
||||
\
|
||||
&& cd /usr/src/postgresql \
|
||||
# update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian)
|
||||
# see https://anonscm.debian.org/git/pkg-postgresql/postgresql.git/tree/debian/patches/51-default-sockets-in-var.patch?id=8b539fcb3e093a521c095e70bdfa76887217b89f
|
||||
&& awk '$1 == "#define" && $2 == "DEFAULT_PGSOCKET_DIR" && $3 == "\"/tmp\"" { $3 = "\"/var/run/postgresql\""; print; next } { print }' src/include/pg_config_manual.h > src/include/pg_config_manual.h.new \
|
||||
&& grep '/var/run/postgresql' src/include/pg_config_manual.h.new \
|
||||
&& mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h \
|
||||
# configure options taken from:
|
||||
# https://anonscm.debian.org/cgit/pkg-postgresql/postgresql.git/tree/debian/rules?h=9.5
|
||||
&& ./configure \
|
||||
@ -113,10 +118,11 @@ RUN set -ex \
|
||||
# make the sample config easier to munge (and "correct by default")
|
||||
RUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample
|
||||
|
||||
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
|
||||
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod g+s /var/run/postgresql
|
||||
|
||||
ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
|
||||
ENV PGDATA /var/lib/postgresql/data
|
||||
RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 700 "$PGDATA"
|
||||
VOLUME /var/lib/postgresql/data
|
||||
|
||||
COPY docker-entrypoint.sh /
|
||||
|
@ -29,12 +29,13 @@ fi
|
||||
|
||||
if [ "$1" = 'postgres' ]; then
|
||||
mkdir -p "$PGDATA"
|
||||
chmod 700 "$PGDATA"
|
||||
chown -R postgres "$PGDATA"
|
||||
chmod 700 "$PGDATA"
|
||||
|
||||
mkdir -p /var/run/postgresql
|
||||
chown -R postgres /var/run/postgresql
|
||||
chmod g+s /var/run/postgresql
|
||||
|
||||
mkdir -p /run/postgresql
|
||||
chmod g+s /run/postgresql
|
||||
chown -R postgres /run/postgresql
|
||||
|
||||
# look specifically for PG_VERSION, as it is expected in the DB dir
|
||||
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
||||
|
@ -29,12 +29,13 @@ fi
|
||||
|
||||
if [ "$1" = 'postgres' ]; then
|
||||
mkdir -p "$PGDATA"
|
||||
chmod 700 "$PGDATA"
|
||||
chown -R postgres "$PGDATA"
|
||||
chmod 700 "$PGDATA"
|
||||
|
||||
mkdir -p /var/run/postgresql
|
||||
chown -R postgres /var/run/postgresql
|
||||
chmod g+s /var/run/postgresql
|
||||
|
||||
mkdir -p /run/postgresql
|
||||
chmod g+s /run/postgresql
|
||||
chown -R postgres /run/postgresql
|
||||
|
||||
# look specifically for PG_VERSION, as it is expected in the DB dir
|
||||
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
||||
|
@ -54,10 +54,11 @@ RUN mv -v /usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample /usr/share/post
|
||||
&& ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
|
||||
&& sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample
|
||||
|
||||
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
|
||||
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod g+s /var/run/postgresql
|
||||
|
||||
ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
|
||||
ENV PGDATA /var/lib/postgresql/data
|
||||
RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 700 "$PGDATA"
|
||||
VOLUME /var/lib/postgresql/data
|
||||
|
||||
COPY docker-entrypoint.sh /
|
||||
|
@ -55,6 +55,11 @@ RUN set -ex \
|
||||
zlib-dev \
|
||||
\
|
||||
&& cd /usr/src/postgresql \
|
||||
# update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian)
|
||||
# see https://anonscm.debian.org/git/pkg-postgresql/postgresql.git/tree/debian/patches/51-default-sockets-in-var.patch?id=8b539fcb3e093a521c095e70bdfa76887217b89f
|
||||
&& awk '$1 == "#define" && $2 == "DEFAULT_PGSOCKET_DIR" && $3 == "\"/tmp\"" { $3 = "\"/var/run/postgresql\""; print; next } { print }' src/include/pg_config_manual.h > src/include/pg_config_manual.h.new \
|
||||
&& grep '/var/run/postgresql' src/include/pg_config_manual.h.new \
|
||||
&& mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h \
|
||||
# configure options taken from:
|
||||
# https://anonscm.debian.org/cgit/pkg-postgresql/postgresql.git/tree/debian/rules?h=9.5
|
||||
&& ./configure \
|
||||
@ -113,10 +118,11 @@ RUN set -ex \
|
||||
# make the sample config easier to munge (and "correct by default")
|
||||
RUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample
|
||||
|
||||
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
|
||||
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod g+s /var/run/postgresql
|
||||
|
||||
ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
|
||||
ENV PGDATA /var/lib/postgresql/data
|
||||
RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 700 "$PGDATA"
|
||||
VOLUME /var/lib/postgresql/data
|
||||
|
||||
COPY docker-entrypoint.sh /
|
||||
|
@ -29,12 +29,13 @@ fi
|
||||
|
||||
if [ "$1" = 'postgres' ]; then
|
||||
mkdir -p "$PGDATA"
|
||||
chmod 700 "$PGDATA"
|
||||
chown -R postgres "$PGDATA"
|
||||
chmod 700 "$PGDATA"
|
||||
|
||||
mkdir -p /var/run/postgresql
|
||||
chown -R postgres /var/run/postgresql
|
||||
chmod g+s /var/run/postgresql
|
||||
|
||||
mkdir -p /run/postgresql
|
||||
chmod g+s /run/postgresql
|
||||
chown -R postgres /run/postgresql
|
||||
|
||||
# look specifically for PG_VERSION, as it is expected in the DB dir
|
||||
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
||||
|
@ -29,12 +29,13 @@ fi
|
||||
|
||||
if [ "$1" = 'postgres' ]; then
|
||||
mkdir -p "$PGDATA"
|
||||
chmod 700 "$PGDATA"
|
||||
chown -R postgres "$PGDATA"
|
||||
chmod 700 "$PGDATA"
|
||||
|
||||
mkdir -p /var/run/postgresql
|
||||
chown -R postgres /var/run/postgresql
|
||||
chmod g+s /var/run/postgresql
|
||||
|
||||
mkdir -p /run/postgresql
|
||||
chmod g+s /run/postgresql
|
||||
chown -R postgres /run/postgresql
|
||||
|
||||
# look specifically for PG_VERSION, as it is expected in the DB dir
|
||||
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
||||
|
@ -54,10 +54,11 @@ RUN mv -v /usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample /usr/share/post
|
||||
&& ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
|
||||
&& sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample
|
||||
|
||||
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
|
||||
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod g+s /var/run/postgresql
|
||||
|
||||
ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
|
||||
ENV PGDATA /var/lib/postgresql/data
|
||||
RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 700 "$PGDATA"
|
||||
VOLUME /var/lib/postgresql/data
|
||||
|
||||
COPY docker-entrypoint.sh /
|
||||
|
@ -55,6 +55,11 @@ RUN set -ex \
|
||||
zlib-dev \
|
||||
\
|
||||
&& cd /usr/src/postgresql \
|
||||
# update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian)
|
||||
# see https://anonscm.debian.org/git/pkg-postgresql/postgresql.git/tree/debian/patches/51-default-sockets-in-var.patch?id=8b539fcb3e093a521c095e70bdfa76887217b89f
|
||||
&& awk '$1 == "#define" && $2 == "DEFAULT_PGSOCKET_DIR" && $3 == "\"/tmp\"" { $3 = "\"/var/run/postgresql\""; print; next } { print }' src/include/pg_config_manual.h > src/include/pg_config_manual.h.new \
|
||||
&& grep '/var/run/postgresql' src/include/pg_config_manual.h.new \
|
||||
&& mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h \
|
||||
# configure options taken from:
|
||||
# https://anonscm.debian.org/cgit/pkg-postgresql/postgresql.git/tree/debian/rules?h=9.5
|
||||
&& ./configure \
|
||||
@ -113,10 +118,11 @@ RUN set -ex \
|
||||
# make the sample config easier to munge (and "correct by default")
|
||||
RUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample
|
||||
|
||||
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
|
||||
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod g+s /var/run/postgresql
|
||||
|
||||
ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
|
||||
ENV PGDATA /var/lib/postgresql/data
|
||||
RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 700 "$PGDATA"
|
||||
VOLUME /var/lib/postgresql/data
|
||||
|
||||
COPY docker-entrypoint.sh /
|
||||
|
@ -29,12 +29,13 @@ fi
|
||||
|
||||
if [ "$1" = 'postgres' ]; then
|
||||
mkdir -p "$PGDATA"
|
||||
chmod 700 "$PGDATA"
|
||||
chown -R postgres "$PGDATA"
|
||||
chmod 700 "$PGDATA"
|
||||
|
||||
mkdir -p /var/run/postgresql
|
||||
chown -R postgres /var/run/postgresql
|
||||
chmod g+s /var/run/postgresql
|
||||
|
||||
mkdir -p /run/postgresql
|
||||
chmod g+s /run/postgresql
|
||||
chown -R postgres /run/postgresql
|
||||
|
||||
# look specifically for PG_VERSION, as it is expected in the DB dir
|
||||
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
||||
|
@ -29,12 +29,13 @@ fi
|
||||
|
||||
if [ "$1" = 'postgres' ]; then
|
||||
mkdir -p "$PGDATA"
|
||||
chmod 700 "$PGDATA"
|
||||
chown -R postgres "$PGDATA"
|
||||
chmod 700 "$PGDATA"
|
||||
|
||||
mkdir -p /var/run/postgresql
|
||||
chown -R postgres /var/run/postgresql
|
||||
chmod g+s /var/run/postgresql
|
||||
|
||||
mkdir -p /run/postgresql
|
||||
chmod g+s /run/postgresql
|
||||
chown -R postgres /run/postgresql
|
||||
|
||||
# look specifically for PG_VERSION, as it is expected in the DB dir
|
||||
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
||||
|
@ -54,10 +54,11 @@ RUN mv -v /usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample /usr/share/post
|
||||
&& ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
|
||||
&& sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample
|
||||
|
||||
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
|
||||
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod g+s /var/run/postgresql
|
||||
|
||||
ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
|
||||
ENV PGDATA /var/lib/postgresql/data
|
||||
RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 700 "$PGDATA"
|
||||
VOLUME /var/lib/postgresql/data
|
||||
|
||||
COPY docker-entrypoint.sh /
|
||||
|
@ -55,6 +55,11 @@ RUN set -ex \
|
||||
zlib-dev \
|
||||
\
|
||||
&& cd /usr/src/postgresql \
|
||||
# update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian)
|
||||
# see https://anonscm.debian.org/git/pkg-postgresql/postgresql.git/tree/debian/patches/51-default-sockets-in-var.patch?id=8b539fcb3e093a521c095e70bdfa76887217b89f
|
||||
&& awk '$1 == "#define" && $2 == "DEFAULT_PGSOCKET_DIR" && $3 == "\"/tmp\"" { $3 = "\"/var/run/postgresql\""; print; next } { print }' src/include/pg_config_manual.h > src/include/pg_config_manual.h.new \
|
||||
&& grep '/var/run/postgresql' src/include/pg_config_manual.h.new \
|
||||
&& mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h \
|
||||
# configure options taken from:
|
||||
# https://anonscm.debian.org/cgit/pkg-postgresql/postgresql.git/tree/debian/rules?h=9.5
|
||||
&& ./configure \
|
||||
@ -113,10 +118,11 @@ RUN set -ex \
|
||||
# make the sample config easier to munge (and "correct by default")
|
||||
RUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample
|
||||
|
||||
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
|
||||
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod g+s /var/run/postgresql
|
||||
|
||||
ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
|
||||
ENV PGDATA /var/lib/postgresql/data
|
||||
RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 700 "$PGDATA"
|
||||
VOLUME /var/lib/postgresql/data
|
||||
|
||||
COPY docker-entrypoint.sh /
|
||||
|
@ -29,12 +29,13 @@ fi
|
||||
|
||||
if [ "$1" = 'postgres' ]; then
|
||||
mkdir -p "$PGDATA"
|
||||
chmod 700 "$PGDATA"
|
||||
chown -R postgres "$PGDATA"
|
||||
chmod 700 "$PGDATA"
|
||||
|
||||
mkdir -p /var/run/postgresql
|
||||
chown -R postgres /var/run/postgresql
|
||||
chmod g+s /var/run/postgresql
|
||||
|
||||
mkdir -p /run/postgresql
|
||||
chmod g+s /run/postgresql
|
||||
chown -R postgres /run/postgresql
|
||||
|
||||
# look specifically for PG_VERSION, as it is expected in the DB dir
|
||||
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
||||
|
@ -29,12 +29,13 @@ fi
|
||||
|
||||
if [ "$1" = 'postgres' ]; then
|
||||
mkdir -p "$PGDATA"
|
||||
chmod 700 "$PGDATA"
|
||||
chown -R postgres "$PGDATA"
|
||||
chmod 700 "$PGDATA"
|
||||
|
||||
mkdir -p /var/run/postgresql
|
||||
chown -R postgres /var/run/postgresql
|
||||
chmod g+s /var/run/postgresql
|
||||
|
||||
mkdir -p /run/postgresql
|
||||
chmod g+s /run/postgresql
|
||||
chown -R postgres /run/postgresql
|
||||
|
||||
# look specifically for PG_VERSION, as it is expected in the DB dir
|
||||
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
||||
|
@ -54,10 +54,11 @@ RUN mv -v /usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample /usr/share/post
|
||||
&& ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
|
||||
&& sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample
|
||||
|
||||
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
|
||||
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod g+s /var/run/postgresql
|
||||
|
||||
ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
|
||||
ENV PGDATA /var/lib/postgresql/data
|
||||
RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 700 "$PGDATA"
|
||||
VOLUME /var/lib/postgresql/data
|
||||
|
||||
COPY docker-entrypoint.sh /
|
||||
|
@ -55,6 +55,11 @@ RUN set -ex \
|
||||
zlib-dev \
|
||||
\
|
||||
&& cd /usr/src/postgresql \
|
||||
# update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian)
|
||||
# see https://anonscm.debian.org/git/pkg-postgresql/postgresql.git/tree/debian/patches/51-default-sockets-in-var.patch?id=8b539fcb3e093a521c095e70bdfa76887217b89f
|
||||
&& awk '$1 == "#define" && $2 == "DEFAULT_PGSOCKET_DIR" && $3 == "\"/tmp\"" { $3 = "\"/var/run/postgresql\""; print; next } { print }' src/include/pg_config_manual.h > src/include/pg_config_manual.h.new \
|
||||
&& grep '/var/run/postgresql' src/include/pg_config_manual.h.new \
|
||||
&& mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h \
|
||||
# configure options taken from:
|
||||
# https://anonscm.debian.org/cgit/pkg-postgresql/postgresql.git/tree/debian/rules?h=9.5
|
||||
&& ./configure \
|
||||
@ -113,10 +118,11 @@ RUN set -ex \
|
||||
# make the sample config easier to munge (and "correct by default")
|
||||
RUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample
|
||||
|
||||
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
|
||||
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod g+s /var/run/postgresql
|
||||
|
||||
ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
|
||||
ENV PGDATA /var/lib/postgresql/data
|
||||
RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 700 "$PGDATA"
|
||||
VOLUME /var/lib/postgresql/data
|
||||
|
||||
COPY docker-entrypoint.sh /
|
||||
|
@ -29,12 +29,13 @@ fi
|
||||
|
||||
if [ "$1" = 'postgres' ]; then
|
||||
mkdir -p "$PGDATA"
|
||||
chmod 700 "$PGDATA"
|
||||
chown -R postgres "$PGDATA"
|
||||
chmod 700 "$PGDATA"
|
||||
|
||||
mkdir -p /var/run/postgresql
|
||||
chown -R postgres /var/run/postgresql
|
||||
chmod g+s /var/run/postgresql
|
||||
|
||||
mkdir -p /run/postgresql
|
||||
chmod g+s /run/postgresql
|
||||
chown -R postgres /run/postgresql
|
||||
|
||||
# look specifically for PG_VERSION, as it is expected in the DB dir
|
||||
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
||||
|
@ -29,12 +29,13 @@ fi
|
||||
|
||||
if [ "$1" = 'postgres' ]; then
|
||||
mkdir -p "$PGDATA"
|
||||
chmod 700 "$PGDATA"
|
||||
chown -R postgres "$PGDATA"
|
||||
chmod 700 "$PGDATA"
|
||||
|
||||
mkdir -p /var/run/postgresql
|
||||
chown -R postgres /var/run/postgresql
|
||||
chmod g+s /var/run/postgresql
|
||||
|
||||
mkdir -p /run/postgresql
|
||||
chmod g+s /run/postgresql
|
||||
chown -R postgres /run/postgresql
|
||||
|
||||
# look specifically for PG_VERSION, as it is expected in the DB dir
|
||||
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
||||
|
@ -55,6 +55,11 @@ RUN set -ex \
|
||||
zlib-dev \
|
||||
\
|
||||
&& cd /usr/src/postgresql \
|
||||
# update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian)
|
||||
# see https://anonscm.debian.org/git/pkg-postgresql/postgresql.git/tree/debian/patches/51-default-sockets-in-var.patch?id=8b539fcb3e093a521c095e70bdfa76887217b89f
|
||||
&& awk '$1 == "#define" && $2 == "DEFAULT_PGSOCKET_DIR" && $3 == "\"/tmp\"" { $3 = "\"/var/run/postgresql\""; print; next } { print }' src/include/pg_config_manual.h > src/include/pg_config_manual.h.new \
|
||||
&& grep '/var/run/postgresql' src/include/pg_config_manual.h.new \
|
||||
&& mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h \
|
||||
# configure options taken from:
|
||||
# https://anonscm.debian.org/cgit/pkg-postgresql/postgresql.git/tree/debian/rules?h=9.5
|
||||
&& ./configure \
|
||||
@ -113,10 +118,11 @@ RUN set -ex \
|
||||
# make the sample config easier to munge (and "correct by default")
|
||||
RUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample
|
||||
|
||||
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
|
||||
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod g+s /var/run/postgresql
|
||||
|
||||
ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
|
||||
ENV PGDATA /var/lib/postgresql/data
|
||||
RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 700 "$PGDATA"
|
||||
VOLUME /var/lib/postgresql/data
|
||||
|
||||
COPY docker-entrypoint.sh /
|
||||
|
@ -54,10 +54,11 @@ RUN mv -v /usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample /usr/share/post
|
||||
&& ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
|
||||
&& sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample
|
||||
|
||||
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
|
||||
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod g+s /var/run/postgresql
|
||||
|
||||
ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
|
||||
ENV PGDATA /var/lib/postgresql/data
|
||||
RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 700 "$PGDATA"
|
||||
VOLUME /var/lib/postgresql/data
|
||||
|
||||
COPY docker-entrypoint.sh /
|
||||
|
@ -29,12 +29,13 @@ fi
|
||||
|
||||
if [ "$1" = 'postgres' ]; then
|
||||
mkdir -p "$PGDATA"
|
||||
chmod 700 "$PGDATA"
|
||||
chown -R postgres "$PGDATA"
|
||||
chmod 700 "$PGDATA"
|
||||
|
||||
mkdir -p /var/run/postgresql
|
||||
chown -R postgres /var/run/postgresql
|
||||
chmod g+s /var/run/postgresql
|
||||
|
||||
mkdir -p /run/postgresql
|
||||
chmod g+s /run/postgresql
|
||||
chown -R postgres /run/postgresql
|
||||
|
||||
# look specifically for PG_VERSION, as it is expected in the DB dir
|
||||
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
||||
|
Reference in New Issue
Block a user