Merge pull request #1372 from infosiftr/more-graceful-error

Remove intentionally-breaking "data" symlink and add better detection
This commit is contained in:
yosifkit 2025-10-21 17:04:53 -07:00 committed by GitHub
commit 23987751b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
28 changed files with 275 additions and 53 deletions

View File

@ -168,8 +168,14 @@ docker_error_old_databases() {
Counter to that, there appears to be PostgreSQL data in:
${OLD_DATABASES[*]}
This is usually the result of upgrading the Docker image without upgrading
the underlying database using "pg_upgrade" (which requires both versions).
This is usually the result of upgrading the Docker image without
upgrading the underlying database using "pg_upgrade" (which requires both
versions).
The suggested container configuration for 18+ is to place a single mount
at /var/lib/postgresql which will then place PostgreSQL data in a
subdirectory, allowing usage of "pg_upgrade --link" without mount point
boundary issues.
See https://github.com/docker-library/postgres/issues/37 for a (long)
discussion around this process, and suggestions for how to do so.
@ -264,6 +270,9 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
}

View File

@ -168,8 +168,14 @@ docker_error_old_databases() {
Counter to that, there appears to be PostgreSQL data in:
${OLD_DATABASES[*]}
This is usually the result of upgrading the Docker image without upgrading
the underlying database using "pg_upgrade" (which requires both versions).
This is usually the result of upgrading the Docker image without
upgrading the underlying database using "pg_upgrade" (which requires both
versions).
The suggested container configuration for 18+ is to place a single mount
at /var/lib/postgresql which will then place PostgreSQL data in a
subdirectory, allowing usage of "pg_upgrade --link" without mount point
boundary issues.
See https://github.com/docker-library/postgres/issues/37 for a (long)
discussion around this process, and suggestions for how to do so.
@ -264,6 +270,9 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
}

View File

@ -168,8 +168,14 @@ docker_error_old_databases() {
Counter to that, there appears to be PostgreSQL data in:
${OLD_DATABASES[*]}
This is usually the result of upgrading the Docker image without upgrading
the underlying database using "pg_upgrade" (which requires both versions).
This is usually the result of upgrading the Docker image without
upgrading the underlying database using "pg_upgrade" (which requires both
versions).
The suggested container configuration for 18+ is to place a single mount
at /var/lib/postgresql which will then place PostgreSQL data in a
subdirectory, allowing usage of "pg_upgrade --link" without mount point
boundary issues.
See https://github.com/docker-library/postgres/issues/37 for a (long)
discussion around this process, and suggestions for how to do so.
@ -264,6 +270,9 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
}

View File

@ -168,8 +168,14 @@ docker_error_old_databases() {
Counter to that, there appears to be PostgreSQL data in:
${OLD_DATABASES[*]}
This is usually the result of upgrading the Docker image without upgrading
the underlying database using "pg_upgrade" (which requires both versions).
This is usually the result of upgrading the Docker image without
upgrading the underlying database using "pg_upgrade" (which requires both
versions).
The suggested container configuration for 18+ is to place a single mount
at /var/lib/postgresql which will then place PostgreSQL data in a
subdirectory, allowing usage of "pg_upgrade --link" without mount point
boundary issues.
See https://github.com/docker-library/postgres/issues/37 for a (long)
discussion around this process, and suggestions for how to do so.
@ -264,6 +270,9 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
}

View File

@ -168,8 +168,14 @@ docker_error_old_databases() {
Counter to that, there appears to be PostgreSQL data in:
${OLD_DATABASES[*]}
This is usually the result of upgrading the Docker image without upgrading
the underlying database using "pg_upgrade" (which requires both versions).
This is usually the result of upgrading the Docker image without
upgrading the underlying database using "pg_upgrade" (which requires both
versions).
The suggested container configuration for 18+ is to place a single mount
at /var/lib/postgresql which will then place PostgreSQL data in a
subdirectory, allowing usage of "pg_upgrade --link" without mount point
boundary issues.
See https://github.com/docker-library/postgres/issues/37 for a (long)
discussion around this process, and suggestions for how to do so.
@ -264,6 +270,9 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
}

View File

@ -168,8 +168,14 @@ docker_error_old_databases() {
Counter to that, there appears to be PostgreSQL data in:
${OLD_DATABASES[*]}
This is usually the result of upgrading the Docker image without upgrading
the underlying database using "pg_upgrade" (which requires both versions).
This is usually the result of upgrading the Docker image without
upgrading the underlying database using "pg_upgrade" (which requires both
versions).
The suggested container configuration for 18+ is to place a single mount
at /var/lib/postgresql which will then place PostgreSQL data in a
subdirectory, allowing usage of "pg_upgrade --link" without mount point
boundary issues.
See https://github.com/docker-library/postgres/issues/37 for a (long)
discussion around this process, and suggestions for how to do so.
@ -264,6 +270,9 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
}

View File

@ -168,8 +168,14 @@ docker_error_old_databases() {
Counter to that, there appears to be PostgreSQL data in:
${OLD_DATABASES[*]}
This is usually the result of upgrading the Docker image without upgrading
the underlying database using "pg_upgrade" (which requires both versions).
This is usually the result of upgrading the Docker image without
upgrading the underlying database using "pg_upgrade" (which requires both
versions).
The suggested container configuration for 18+ is to place a single mount
at /var/lib/postgresql which will then place PostgreSQL data in a
subdirectory, allowing usage of "pg_upgrade --link" without mount point
boundary issues.
See https://github.com/docker-library/postgres/issues/37 for a (long)
discussion around this process, and suggestions for how to do so.
@ -264,6 +270,9 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
}

View File

@ -168,8 +168,14 @@ docker_error_old_databases() {
Counter to that, there appears to be PostgreSQL data in:
${OLD_DATABASES[*]}
This is usually the result of upgrading the Docker image without upgrading
the underlying database using "pg_upgrade" (which requires both versions).
This is usually the result of upgrading the Docker image without
upgrading the underlying database using "pg_upgrade" (which requires both
versions).
The suggested container configuration for 18+ is to place a single mount
at /var/lib/postgresql which will then place PostgreSQL data in a
subdirectory, allowing usage of "pg_upgrade --link" without mount point
boundary issues.
See https://github.com/docker-library/postgres/issues/37 for a (long)
discussion around this process, and suggestions for how to do so.
@ -264,6 +270,9 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
}

View File

@ -168,8 +168,14 @@ docker_error_old_databases() {
Counter to that, there appears to be PostgreSQL data in:
${OLD_DATABASES[*]}
This is usually the result of upgrading the Docker image without upgrading
the underlying database using "pg_upgrade" (which requires both versions).
This is usually the result of upgrading the Docker image without
upgrading the underlying database using "pg_upgrade" (which requires both
versions).
The suggested container configuration for 18+ is to place a single mount
at /var/lib/postgresql which will then place PostgreSQL data in a
subdirectory, allowing usage of "pg_upgrade --link" without mount point
boundary issues.
See https://github.com/docker-library/postgres/issues/37 for a (long)
discussion around this process, and suggestions for how to do so.
@ -264,6 +270,9 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
}

View File

@ -168,8 +168,14 @@ docker_error_old_databases() {
Counter to that, there appears to be PostgreSQL data in:
${OLD_DATABASES[*]}
This is usually the result of upgrading the Docker image without upgrading
the underlying database using "pg_upgrade" (which requires both versions).
This is usually the result of upgrading the Docker image without
upgrading the underlying database using "pg_upgrade" (which requires both
versions).
The suggested container configuration for 18+ is to place a single mount
at /var/lib/postgresql which will then place PostgreSQL data in a
subdirectory, allowing usage of "pg_upgrade --link" without mount point
boundary issues.
See https://github.com/docker-library/postgres/issues/37 for a (long)
discussion around this process, and suggestions for how to do so.
@ -264,6 +270,9 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
}

View File

@ -168,8 +168,14 @@ docker_error_old_databases() {
Counter to that, there appears to be PostgreSQL data in:
${OLD_DATABASES[*]}
This is usually the result of upgrading the Docker image without upgrading
the underlying database using "pg_upgrade" (which requires both versions).
This is usually the result of upgrading the Docker image without
upgrading the underlying database using "pg_upgrade" (which requires both
versions).
The suggested container configuration for 18+ is to place a single mount
at /var/lib/postgresql which will then place PostgreSQL data in a
subdirectory, allowing usage of "pg_upgrade --link" without mount point
boundary issues.
See https://github.com/docker-library/postgres/issues/37 for a (long)
discussion around this process, and suggestions for how to do so.
@ -264,6 +270,9 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
}

View File

@ -168,8 +168,14 @@ docker_error_old_databases() {
Counter to that, there appears to be PostgreSQL data in:
${OLD_DATABASES[*]}
This is usually the result of upgrading the Docker image without upgrading
the underlying database using "pg_upgrade" (which requires both versions).
This is usually the result of upgrading the Docker image without
upgrading the underlying database using "pg_upgrade" (which requires both
versions).
The suggested container configuration for 18+ is to place a single mount
at /var/lib/postgresql which will then place PostgreSQL data in a
subdirectory, allowing usage of "pg_upgrade --link" without mount point
boundary issues.
See https://github.com/docker-library/postgres/issues/37 for a (long)
discussion around this process, and suggestions for how to do so.
@ -264,6 +270,9 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
}

View File

@ -168,8 +168,14 @@ docker_error_old_databases() {
Counter to that, there appears to be PostgreSQL data in:
${OLD_DATABASES[*]}
This is usually the result of upgrading the Docker image without upgrading
the underlying database using "pg_upgrade" (which requires both versions).
This is usually the result of upgrading the Docker image without
upgrading the underlying database using "pg_upgrade" (which requires both
versions).
The suggested container configuration for 18+ is to place a single mount
at /var/lib/postgresql which will then place PostgreSQL data in a
subdirectory, allowing usage of "pg_upgrade --link" without mount point
boundary issues.
See https://github.com/docker-library/postgres/issues/37 for a (long)
discussion around this process, and suggestions for how to do so.
@ -264,6 +270,9 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
}

View File

@ -168,8 +168,14 @@ docker_error_old_databases() {
Counter to that, there appears to be PostgreSQL data in:
${OLD_DATABASES[*]}
This is usually the result of upgrading the Docker image without upgrading
the underlying database using "pg_upgrade" (which requires both versions).
This is usually the result of upgrading the Docker image without
upgrading the underlying database using "pg_upgrade" (which requires both
versions).
The suggested container configuration for 18+ is to place a single mount
at /var/lib/postgresql which will then place PostgreSQL data in a
subdirectory, allowing usage of "pg_upgrade --link" without mount point
boundary issues.
See https://github.com/docker-library/postgres/issues/37 for a (long)
discussion around this process, and suggestions for how to do so.
@ -264,6 +270,9 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
}

View File

@ -168,8 +168,14 @@ docker_error_old_databases() {
Counter to that, there appears to be PostgreSQL data in:
${OLD_DATABASES[*]}
This is usually the result of upgrading the Docker image without upgrading
the underlying database using "pg_upgrade" (which requires both versions).
This is usually the result of upgrading the Docker image without
upgrading the underlying database using "pg_upgrade" (which requires both
versions).
The suggested container configuration for 18+ is to place a single mount
at /var/lib/postgresql which will then place PostgreSQL data in a
subdirectory, allowing usage of "pg_upgrade --link" without mount point
boundary issues.
See https://github.com/docker-library/postgres/issues/37 for a (long)
discussion around this process, and suggestions for how to do so.
@ -264,6 +270,9 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
}

View File

@ -168,8 +168,14 @@ docker_error_old_databases() {
Counter to that, there appears to be PostgreSQL data in:
${OLD_DATABASES[*]}
This is usually the result of upgrading the Docker image without upgrading
the underlying database using "pg_upgrade" (which requires both versions).
This is usually the result of upgrading the Docker image without
upgrading the underlying database using "pg_upgrade" (which requires both
versions).
The suggested container configuration for 18+ is to place a single mount
at /var/lib/postgresql which will then place PostgreSQL data in a
subdirectory, allowing usage of "pg_upgrade --link" without mount point
boundary issues.
See https://github.com/docker-library/postgres/issues/37 for a (long)
discussion around this process, and suggestions for how to do so.
@ -264,6 +270,9 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
}

View File

@ -168,8 +168,14 @@ docker_error_old_databases() {
Counter to that, there appears to be PostgreSQL data in:
${OLD_DATABASES[*]}
This is usually the result of upgrading the Docker image without upgrading
the underlying database using "pg_upgrade" (which requires both versions).
This is usually the result of upgrading the Docker image without
upgrading the underlying database using "pg_upgrade" (which requires both
versions).
The suggested container configuration for 18+ is to place a single mount
at /var/lib/postgresql which will then place PostgreSQL data in a
subdirectory, allowing usage of "pg_upgrade --link" without mount point
boundary issues.
See https://github.com/docker-library/postgres/issues/37 for a (long)
discussion around this process, and suggestions for how to do so.
@ -264,6 +270,9 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
}

View File

@ -168,8 +168,14 @@ docker_error_old_databases() {
Counter to that, there appears to be PostgreSQL data in:
${OLD_DATABASES[*]}
This is usually the result of upgrading the Docker image without upgrading
the underlying database using "pg_upgrade" (which requires both versions).
This is usually the result of upgrading the Docker image without
upgrading the underlying database using "pg_upgrade" (which requires both
versions).
The suggested container configuration for 18+ is to place a single mount
at /var/lib/postgresql which will then place PostgreSQL data in a
subdirectory, allowing usage of "pg_upgrade --link" without mount point
boundary issues.
See https://github.com/docker-library/postgres/issues/37 for a (long)
discussion around this process, and suggestions for how to do so.
@ -264,6 +270,9 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
}

View File

@ -168,8 +168,14 @@ docker_error_old_databases() {
Counter to that, there appears to be PostgreSQL data in:
${OLD_DATABASES[*]}
This is usually the result of upgrading the Docker image without upgrading
the underlying database using "pg_upgrade" (which requires both versions).
This is usually the result of upgrading the Docker image without
upgrading the underlying database using "pg_upgrade" (which requires both
versions).
The suggested container configuration for 18+ is to place a single mount
at /var/lib/postgresql which will then place PostgreSQL data in a
subdirectory, allowing usage of "pg_upgrade --link" without mount point
boundary issues.
See https://github.com/docker-library/postgres/issues/37 for a (long)
discussion around this process, and suggestions for how to do so.
@ -264,6 +270,9 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
}

View File

@ -168,8 +168,14 @@ docker_error_old_databases() {
Counter to that, there appears to be PostgreSQL data in:
${OLD_DATABASES[*]}
This is usually the result of upgrading the Docker image without upgrading
the underlying database using "pg_upgrade" (which requires both versions).
This is usually the result of upgrading the Docker image without
upgrading the underlying database using "pg_upgrade" (which requires both
versions).
The suggested container configuration for 18+ is to place a single mount
at /var/lib/postgresql which will then place PostgreSQL data in a
subdirectory, allowing usage of "pg_upgrade --link" without mount point
boundary issues.
See https://github.com/docker-library/postgres/issues/37 for a (long)
discussion around this process, and suggestions for how to do so.
@ -264,6 +270,9 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
}

View File

@ -168,8 +168,14 @@ docker_error_old_databases() {
Counter to that, there appears to be PostgreSQL data in:
${OLD_DATABASES[*]}
This is usually the result of upgrading the Docker image without upgrading
the underlying database using "pg_upgrade" (which requires both versions).
This is usually the result of upgrading the Docker image without
upgrading the underlying database using "pg_upgrade" (which requires both
versions).
The suggested container configuration for 18+ is to place a single mount
at /var/lib/postgresql which will then place PostgreSQL data in a
subdirectory, allowing usage of "pg_upgrade --link" without mount point
boundary issues.
See https://github.com/docker-library/postgres/issues/37 for a (long)
discussion around this process, and suggestions for how to do so.
@ -264,6 +270,9 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
}

View File

@ -168,8 +168,14 @@ docker_error_old_databases() {
Counter to that, there appears to be PostgreSQL data in:
${OLD_DATABASES[*]}
This is usually the result of upgrading the Docker image without upgrading
the underlying database using "pg_upgrade" (which requires both versions).
This is usually the result of upgrading the Docker image without
upgrading the underlying database using "pg_upgrade" (which requires both
versions).
The suggested container configuration for 18+ is to place a single mount
at /var/lib/postgresql which will then place PostgreSQL data in a
subdirectory, allowing usage of "pg_upgrade --link" without mount point
boundary issues.
See https://github.com/docker-library/postgres/issues/37 for a (long)
discussion around this process, and suggestions for how to do so.
@ -264,6 +270,9 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
}

View File

@ -189,7 +189,6 @@ RUN install --verbose --directory --owner postgres --group postgres --mode 3777
# NOTE: in 18+, 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/18/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)

View File

@ -168,8 +168,14 @@ docker_error_old_databases() {
Counter to that, there appears to be PostgreSQL data in:
${OLD_DATABASES[*]}
This is usually the result of upgrading the Docker image without upgrading
the underlying database using "pg_upgrade" (which requires both versions).
This is usually the result of upgrading the Docker image without
upgrading the underlying database using "pg_upgrade" (which requires both
versions).
The suggested container configuration for 18+ is to place a single mount
at /var/lib/postgresql which will then place PostgreSQL data in a
subdirectory, allowing usage of "pg_upgrade --link" without mount point
boundary issues.
See https://github.com/docker-library/postgres/issues/37 for a (long)
discussion around this process, and suggestions for how to do so.
@ -264,6 +270,9 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
}

1
18/trixie/Dockerfile generated
View File

@ -189,7 +189,6 @@ RUN install --verbose --directory --owner postgres --group postgres --mode 3777
# NOTE: in 18+, 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/18/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)

View File

@ -168,8 +168,14 @@ docker_error_old_databases() {
Counter to that, there appears to be PostgreSQL data in:
${OLD_DATABASES[*]}
This is usually the result of upgrading the Docker image without upgrading
the underlying database using "pg_upgrade" (which requires both versions).
This is usually the result of upgrading the Docker image without
upgrading the underlying database using "pg_upgrade" (which requires both
versions).
The suggested container configuration for 18+ is to place a single mount
at /var/lib/postgresql which will then place PostgreSQL data in a
subdirectory, allowing usage of "pg_upgrade --link" without mount point
boundary issues.
See https://github.com/docker-library/postgres/issues/37 for a (long)
discussion around this process, and suggestions for how to do so.
@ -264,6 +270,9 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
}

View File

@ -190,7 +190,6 @@ RUN install --verbose --directory --owner postgres --group postgres --mode 3777
# NOTE: in 18+, 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 ( -}}

View File

@ -168,8 +168,14 @@ docker_error_old_databases() {
Counter to that, there appears to be PostgreSQL data in:
${OLD_DATABASES[*]}
This is usually the result of upgrading the Docker image without upgrading
the underlying database using "pg_upgrade" (which requires both versions).
This is usually the result of upgrading the Docker image without
upgrading the underlying database using "pg_upgrade" (which requires both
versions).
The suggested container configuration for 18+ is to place a single mount
at /var/lib/postgresql which will then place PostgreSQL data in a
subdirectory, allowing usage of "pg_upgrade --link" without mount point
boundary issues.
See https://github.com/docker-library/postgres/issues/37 for a (long)
discussion around this process, and suggestions for how to do so.
@ -264,6 +270,9 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
}