Merged
Conversation
Changes: - docker-library/postgres@2353f03: Merge pull request docker-library/postgres#1409 from infosiftr/mountpoint-fallback - docker-library/postgres@3b6b5fc: Fix Alpine missing `/var/lib/postgresql/data` mounts
Diff for 5b37e1a:diff --git a/_bashbrew-cat b/_bashbrew-cat
index f4d2818..1d47372 100644
--- a/_bashbrew-cat
+++ b/_bashbrew-cat
@@ -3,100 +3,100 @@ GitRepo: https://github.com/docker-library/postgres.git
Tags: 14.22, 14, 14.22-trixie, 14-trixie
Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: a0e0794dce71d160c89c04611663c69399db0d32
+GitCommit: 3b6b5fca9ca40c84b77540fc605ea8e8353b13b2
Directory: 14/trixie
Tags: 14.22-alpine3.22, 14-alpine3.22
Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: a0e0794dce71d160c89c04611663c69399db0d32
+GitCommit: 3b6b5fca9ca40c84b77540fc605ea8e8353b13b2
Directory: 14/alpine3.22
Tags: 14.22-alpine3.23, 14-alpine3.23, 14.22-alpine, 14-alpine
Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: a0e0794dce71d160c89c04611663c69399db0d32
+GitCommit: 3b6b5fca9ca40c84b77540fc605ea8e8353b13b2
Directory: 14/alpine3.23
Tags: 14.22-bookworm, 14-bookworm
Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: a0e0794dce71d160c89c04611663c69399db0d32
+GitCommit: 3b6b5fca9ca40c84b77540fc605ea8e8353b13b2
Directory: 14/bookworm
Tags: 15.17, 15, 15.17-trixie, 15-trixie
Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: 21d696495924e89b0b6c43088e2783fabdef94be
+GitCommit: 3b6b5fca9ca40c84b77540fc605ea8e8353b13b2
Directory: 15/trixie
Tags: 15.17-alpine3.22, 15-alpine3.22
Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: 21d696495924e89b0b6c43088e2783fabdef94be
+GitCommit: 3b6b5fca9ca40c84b77540fc605ea8e8353b13b2
Directory: 15/alpine3.22
Tags: 15.17-alpine3.23, 15-alpine3.23, 15.17-alpine, 15-alpine
Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: 21d696495924e89b0b6c43088e2783fabdef94be
+GitCommit: 3b6b5fca9ca40c84b77540fc605ea8e8353b13b2
Directory: 15/alpine3.23
Tags: 15.17-bookworm, 15-bookworm
Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 21d696495924e89b0b6c43088e2783fabdef94be
+GitCommit: 3b6b5fca9ca40c84b77540fc605ea8e8353b13b2
Directory: 15/bookworm
Tags: 16.13, 16, 16.13-trixie, 16-trixie
Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: 31041e40d9b06ce075f5edd767243e53efb5ee62
+GitCommit: 3b6b5fca9ca40c84b77540fc605ea8e8353b13b2
Directory: 16/trixie
Tags: 16.13-alpine3.22, 16-alpine3.22
Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: 31041e40d9b06ce075f5edd767243e53efb5ee62
+GitCommit: 3b6b5fca9ca40c84b77540fc605ea8e8353b13b2
Directory: 16/alpine3.22
Tags: 16.13-alpine3.23, 16-alpine3.23, 16.13-alpine, 16-alpine
Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: 31041e40d9b06ce075f5edd767243e53efb5ee62
+GitCommit: 3b6b5fca9ca40c84b77540fc605ea8e8353b13b2
Directory: 16/alpine3.23
Tags: 16.13-bookworm, 16-bookworm
Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 31041e40d9b06ce075f5edd767243e53efb5ee62
+GitCommit: 3b6b5fca9ca40c84b77540fc605ea8e8353b13b2
Directory: 16/bookworm
Tags: 17.9, 17, 17.9-trixie, 17-trixie
Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: 9451a9a586c4c0efc0fc7c31afbe36d9d650c137
+GitCommit: 3b6b5fca9ca40c84b77540fc605ea8e8353b13b2
Directory: 17/trixie
Tags: 17.9-alpine3.22, 17-alpine3.22
Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: 9451a9a586c4c0efc0fc7c31afbe36d9d650c137
+GitCommit: 3b6b5fca9ca40c84b77540fc605ea8e8353b13b2
Directory: 17/alpine3.22
Tags: 17.9-alpine3.23, 17-alpine3.23, 17.9-alpine, 17-alpine
Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: 9451a9a586c4c0efc0fc7c31afbe36d9d650c137
+GitCommit: 3b6b5fca9ca40c84b77540fc605ea8e8353b13b2
Directory: 17/alpine3.23
Tags: 17.9-bookworm, 17-bookworm
Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 9451a9a586c4c0efc0fc7c31afbe36d9d650c137
+GitCommit: 3b6b5fca9ca40c84b77540fc605ea8e8353b13b2
Directory: 17/bookworm
Tags: 18.3, 18, latest, 18.3-trixie, 18-trixie, trixie
Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: 6edb0a8c4def40c371514b34aef9037ec82d9110
+GitCommit: 3b6b5fca9ca40c84b77540fc605ea8e8353b13b2
Directory: 18/trixie
Tags: 18.3-alpine3.22, 18-alpine3.22, alpine3.22
Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: 6edb0a8c4def40c371514b34aef9037ec82d9110
+GitCommit: 3b6b5fca9ca40c84b77540fc605ea8e8353b13b2
Directory: 18/alpine3.22
Tags: 18.3-alpine3.23, 18-alpine3.23, alpine3.23, 18.3-alpine, 18-alpine, alpine
Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: 6edb0a8c4def40c371514b34aef9037ec82d9110
+GitCommit: 3b6b5fca9ca40c84b77540fc605ea8e8353b13b2
Directory: 18/alpine3.23
Tags: 18.3-bookworm, 18-bookworm, bookworm
Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 6edb0a8c4def40c371514b34aef9037ec82d9110
+GitCommit: 3b6b5fca9ca40c84b77540fc605ea8e8353b13b2
Directory: 18/bookworm
diff --git a/postgres_14-alpine/docker-entrypoint.sh b/postgres_14-alpine/docker-entrypoint.sh
index c3432be..d4442d8 100755
--- a/postgres_14-alpine/docker-entrypoint.sh
+++ b/postgres_14-alpine/docker-entrypoint.sh
@@ -252,7 +252,12 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
- if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
+ if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && {
+ # in BusyBox, "mountpoint" only checks dev vs ino (https://github.com/tianon/mirror-busybox/blob/be7d1b7b1701d225379bc1665487ed0871b592a5/util-linux/mountpoint.c#L78) which will notably miss bind mounts entirely (which almost all Docker volume mounts are)
+ # coreutils checks /proc/self/mountinfo, so we have a fallback to mimic that and directly check "/proc/self/mountinfo" to catch that case
+ mountpoint -q /var/lib/postgresql/data \
+ || awk '$5 == "/var/lib/postgresql/data" { found = 1 } END { exit !found }' /proc/self/mountinfo
+ }; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
diff --git a/postgres_14-alpine3.22/docker-entrypoint.sh b/postgres_14-alpine3.22/docker-entrypoint.sh
index c3432be..d4442d8 100755
--- a/postgres_14-alpine3.22/docker-entrypoint.sh
+++ b/postgres_14-alpine3.22/docker-entrypoint.sh
@@ -252,7 +252,12 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
- if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
+ if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && {
+ # in BusyBox, "mountpoint" only checks dev vs ino (https://github.com/tianon/mirror-busybox/blob/be7d1b7b1701d225379bc1665487ed0871b592a5/util-linux/mountpoint.c#L78) which will notably miss bind mounts entirely (which almost all Docker volume mounts are)
+ # coreutils checks /proc/self/mountinfo, so we have a fallback to mimic that and directly check "/proc/self/mountinfo" to catch that case
+ mountpoint -q /var/lib/postgresql/data \
+ || awk '$5 == "/var/lib/postgresql/data" { found = 1 } END { exit !found }' /proc/self/mountinfo
+ }; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
diff --git a/postgres_14-bookworm/docker-entrypoint.sh b/postgres_14-bookworm/docker-entrypoint.sh
index c3432be..d4442d8 100755
--- a/postgres_14-bookworm/docker-entrypoint.sh
+++ b/postgres_14-bookworm/docker-entrypoint.sh
@@ -252,7 +252,12 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
- if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
+ if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && {
+ # in BusyBox, "mountpoint" only checks dev vs ino (https://github.com/tianon/mirror-busybox/blob/be7d1b7b1701d225379bc1665487ed0871b592a5/util-linux/mountpoint.c#L78) which will notably miss bind mounts entirely (which almost all Docker volume mounts are)
+ # coreutils checks /proc/self/mountinfo, so we have a fallback to mimic that and directly check "/proc/self/mountinfo" to catch that case
+ mountpoint -q /var/lib/postgresql/data \
+ || awk '$5 == "/var/lib/postgresql/data" { found = 1 } END { exit !found }' /proc/self/mountinfo
+ }; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
diff --git a/postgres_14-trixie/docker-entrypoint.sh b/postgres_14-trixie/docker-entrypoint.sh
index c3432be..d4442d8 100755
--- a/postgres_14-trixie/docker-entrypoint.sh
+++ b/postgres_14-trixie/docker-entrypoint.sh
@@ -252,7 +252,12 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
- if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
+ if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && {
+ # in BusyBox, "mountpoint" only checks dev vs ino (https://github.com/tianon/mirror-busybox/blob/be7d1b7b1701d225379bc1665487ed0871b592a5/util-linux/mountpoint.c#L78) which will notably miss bind mounts entirely (which almost all Docker volume mounts are)
+ # coreutils checks /proc/self/mountinfo, so we have a fallback to mimic that and directly check "/proc/self/mountinfo" to catch that case
+ mountpoint -q /var/lib/postgresql/data \
+ || awk '$5 == "/var/lib/postgresql/data" { found = 1 } END { exit !found }' /proc/self/mountinfo
+ }; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
diff --git a/postgres_15-alpine/docker-entrypoint.sh b/postgres_15-alpine/docker-entrypoint.sh
index c3432be..d4442d8 100755
--- a/postgres_15-alpine/docker-entrypoint.sh
+++ b/postgres_15-alpine/docker-entrypoint.sh
@@ -252,7 +252,12 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
- if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
+ if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && {
+ # in BusyBox, "mountpoint" only checks dev vs ino (https://github.com/tianon/mirror-busybox/blob/be7d1b7b1701d225379bc1665487ed0871b592a5/util-linux/mountpoint.c#L78) which will notably miss bind mounts entirely (which almost all Docker volume mounts are)
+ # coreutils checks /proc/self/mountinfo, so we have a fallback to mimic that and directly check "/proc/self/mountinfo" to catch that case
+ mountpoint -q /var/lib/postgresql/data \
+ || awk '$5 == "/var/lib/postgresql/data" { found = 1 } END { exit !found }' /proc/self/mountinfo
+ }; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
diff --git a/postgres_15-alpine3.22/docker-entrypoint.sh b/postgres_15-alpine3.22/docker-entrypoint.sh
index c3432be..d4442d8 100755
--- a/postgres_15-alpine3.22/docker-entrypoint.sh
+++ b/postgres_15-alpine3.22/docker-entrypoint.sh
@@ -252,7 +252,12 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
- if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
+ if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && {
+ # in BusyBox, "mountpoint" only checks dev vs ino (https://github.com/tianon/mirror-busybox/blob/be7d1b7b1701d225379bc1665487ed0871b592a5/util-linux/mountpoint.c#L78) which will notably miss bind mounts entirely (which almost all Docker volume mounts are)
+ # coreutils checks /proc/self/mountinfo, so we have a fallback to mimic that and directly check "/proc/self/mountinfo" to catch that case
+ mountpoint -q /var/lib/postgresql/data \
+ || awk '$5 == "/var/lib/postgresql/data" { found = 1 } END { exit !found }' /proc/self/mountinfo
+ }; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
diff --git a/postgres_15-bookworm/docker-entrypoint.sh b/postgres_15-bookworm/docker-entrypoint.sh
index c3432be..d4442d8 100755
--- a/postgres_15-bookworm/docker-entrypoint.sh
+++ b/postgres_15-bookworm/docker-entrypoint.sh
@@ -252,7 +252,12 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
- if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
+ if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && {
+ # in BusyBox, "mountpoint" only checks dev vs ino (https://github.com/tianon/mirror-busybox/blob/be7d1b7b1701d225379bc1665487ed0871b592a5/util-linux/mountpoint.c#L78) which will notably miss bind mounts entirely (which almost all Docker volume mounts are)
+ # coreutils checks /proc/self/mountinfo, so we have a fallback to mimic that and directly check "/proc/self/mountinfo" to catch that case
+ mountpoint -q /var/lib/postgresql/data \
+ || awk '$5 == "/var/lib/postgresql/data" { found = 1 } END { exit !found }' /proc/self/mountinfo
+ }; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
diff --git a/postgres_15-trixie/docker-entrypoint.sh b/postgres_15-trixie/docker-entrypoint.sh
index c3432be..d4442d8 100755
--- a/postgres_15-trixie/docker-entrypoint.sh
+++ b/postgres_15-trixie/docker-entrypoint.sh
@@ -252,7 +252,12 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
- if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
+ if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && {
+ # in BusyBox, "mountpoint" only checks dev vs ino (https://github.com/tianon/mirror-busybox/blob/be7d1b7b1701d225379bc1665487ed0871b592a5/util-linux/mountpoint.c#L78) which will notably miss bind mounts entirely (which almost all Docker volume mounts are)
+ # coreutils checks /proc/self/mountinfo, so we have a fallback to mimic that and directly check "/proc/self/mountinfo" to catch that case
+ mountpoint -q /var/lib/postgresql/data \
+ || awk '$5 == "/var/lib/postgresql/data" { found = 1 } END { exit !found }' /proc/self/mountinfo
+ }; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
diff --git a/postgres_16-alpine/docker-entrypoint.sh b/postgres_16-alpine/docker-entrypoint.sh
index c3432be..d4442d8 100755
--- a/postgres_16-alpine/docker-entrypoint.sh
+++ b/postgres_16-alpine/docker-entrypoint.sh
@@ -252,7 +252,12 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
- if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
+ if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && {
+ # in BusyBox, "mountpoint" only checks dev vs ino (https://github.com/tianon/mirror-busybox/blob/be7d1b7b1701d225379bc1665487ed0871b592a5/util-linux/mountpoint.c#L78) which will notably miss bind mounts entirely (which almost all Docker volume mounts are)
+ # coreutils checks /proc/self/mountinfo, so we have a fallback to mimic that and directly check "/proc/self/mountinfo" to catch that case
+ mountpoint -q /var/lib/postgresql/data \
+ || awk '$5 == "/var/lib/postgresql/data" { found = 1 } END { exit !found }' /proc/self/mountinfo
+ }; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
diff --git a/postgres_16-alpine3.22/docker-entrypoint.sh b/postgres_16-alpine3.22/docker-entrypoint.sh
index c3432be..d4442d8 100755
--- a/postgres_16-alpine3.22/docker-entrypoint.sh
+++ b/postgres_16-alpine3.22/docker-entrypoint.sh
@@ -252,7 +252,12 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
- if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
+ if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && {
+ # in BusyBox, "mountpoint" only checks dev vs ino (https://github.com/tianon/mirror-busybox/blob/be7d1b7b1701d225379bc1665487ed0871b592a5/util-linux/mountpoint.c#L78) which will notably miss bind mounts entirely (which almost all Docker volume mounts are)
+ # coreutils checks /proc/self/mountinfo, so we have a fallback to mimic that and directly check "/proc/self/mountinfo" to catch that case
+ mountpoint -q /var/lib/postgresql/data \
+ || awk '$5 == "/var/lib/postgresql/data" { found = 1 } END { exit !found }' /proc/self/mountinfo
+ }; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
diff --git a/postgres_16-bookworm/docker-entrypoint.sh b/postgres_16-bookworm/docker-entrypoint.sh
index c3432be..d4442d8 100755
--- a/postgres_16-bookworm/docker-entrypoint.sh
+++ b/postgres_16-bookworm/docker-entrypoint.sh
@@ -252,7 +252,12 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
- if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
+ if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && {
+ # in BusyBox, "mountpoint" only checks dev vs ino (https://github.com/tianon/mirror-busybox/blob/be7d1b7b1701d225379bc1665487ed0871b592a5/util-linux/mountpoint.c#L78) which will notably miss bind mounts entirely (which almost all Docker volume mounts are)
+ # coreutils checks /proc/self/mountinfo, so we have a fallback to mimic that and directly check "/proc/self/mountinfo" to catch that case
+ mountpoint -q /var/lib/postgresql/data \
+ || awk '$5 == "/var/lib/postgresql/data" { found = 1 } END { exit !found }' /proc/self/mountinfo
+ }; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
diff --git a/postgres_16-trixie/docker-entrypoint.sh b/postgres_16-trixie/docker-entrypoint.sh
index c3432be..d4442d8 100755
--- a/postgres_16-trixie/docker-entrypoint.sh
+++ b/postgres_16-trixie/docker-entrypoint.sh
@@ -252,7 +252,12 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
- if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
+ if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && {
+ # in BusyBox, "mountpoint" only checks dev vs ino (https://github.com/tianon/mirror-busybox/blob/be7d1b7b1701d225379bc1665487ed0871b592a5/util-linux/mountpoint.c#L78) which will notably miss bind mounts entirely (which almost all Docker volume mounts are)
+ # coreutils checks /proc/self/mountinfo, so we have a fallback to mimic that and directly check "/proc/self/mountinfo" to catch that case
+ mountpoint -q /var/lib/postgresql/data \
+ || awk '$5 == "/var/lib/postgresql/data" { found = 1 } END { exit !found }' /proc/self/mountinfo
+ }; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
diff --git a/postgres_17-alpine/docker-entrypoint.sh b/postgres_17-alpine/docker-entrypoint.sh
index c3432be..d4442d8 100755
--- a/postgres_17-alpine/docker-entrypoint.sh
+++ b/postgres_17-alpine/docker-entrypoint.sh
@@ -252,7 +252,12 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
- if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
+ if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && {
+ # in BusyBox, "mountpoint" only checks dev vs ino (https://github.com/tianon/mirror-busybox/blob/be7d1b7b1701d225379bc1665487ed0871b592a5/util-linux/mountpoint.c#L78) which will notably miss bind mounts entirely (which almost all Docker volume mounts are)
+ # coreutils checks /proc/self/mountinfo, so we have a fallback to mimic that and directly check "/proc/self/mountinfo" to catch that case
+ mountpoint -q /var/lib/postgresql/data \
+ || awk '$5 == "/var/lib/postgresql/data" { found = 1 } END { exit !found }' /proc/self/mountinfo
+ }; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
diff --git a/postgres_17-alpine3.22/docker-entrypoint.sh b/postgres_17-alpine3.22/docker-entrypoint.sh
index c3432be..d4442d8 100755
--- a/postgres_17-alpine3.22/docker-entrypoint.sh
+++ b/postgres_17-alpine3.22/docker-entrypoint.sh
@@ -252,7 +252,12 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
- if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
+ if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && {
+ # in BusyBox, "mountpoint" only checks dev vs ino (https://github.com/tianon/mirror-busybox/blob/be7d1b7b1701d225379bc1665487ed0871b592a5/util-linux/mountpoint.c#L78) which will notably miss bind mounts entirely (which almost all Docker volume mounts are)
+ # coreutils checks /proc/self/mountinfo, so we have a fallback to mimic that and directly check "/proc/self/mountinfo" to catch that case
+ mountpoint -q /var/lib/postgresql/data \
+ || awk '$5 == "/var/lib/postgresql/data" { found = 1 } END { exit !found }' /proc/self/mountinfo
+ }; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
diff --git a/postgres_17-bookworm/docker-entrypoint.sh b/postgres_17-bookworm/docker-entrypoint.sh
index c3432be..d4442d8 100755
--- a/postgres_17-bookworm/docker-entrypoint.sh
+++ b/postgres_17-bookworm/docker-entrypoint.sh
@@ -252,7 +252,12 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
- if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
+ if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && {
+ # in BusyBox, "mountpoint" only checks dev vs ino (https://github.com/tianon/mirror-busybox/blob/be7d1b7b1701d225379bc1665487ed0871b592a5/util-linux/mountpoint.c#L78) which will notably miss bind mounts entirely (which almost all Docker volume mounts are)
+ # coreutils checks /proc/self/mountinfo, so we have a fallback to mimic that and directly check "/proc/self/mountinfo" to catch that case
+ mountpoint -q /var/lib/postgresql/data \
+ || awk '$5 == "/var/lib/postgresql/data" { found = 1 } END { exit !found }' /proc/self/mountinfo
+ }; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
diff --git a/postgres_17-trixie/docker-entrypoint.sh b/postgres_17-trixie/docker-entrypoint.sh
index c3432be..d4442d8 100755
--- a/postgres_17-trixie/docker-entrypoint.sh
+++ b/postgres_17-trixie/docker-entrypoint.sh
@@ -252,7 +252,12 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
- if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
+ if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && {
+ # in BusyBox, "mountpoint" only checks dev vs ino (https://github.com/tianon/mirror-busybox/blob/be7d1b7b1701d225379bc1665487ed0871b592a5/util-linux/mountpoint.c#L78) which will notably miss bind mounts entirely (which almost all Docker volume mounts are)
+ # coreutils checks /proc/self/mountinfo, so we have a fallback to mimic that and directly check "/proc/self/mountinfo" to catch that case
+ mountpoint -q /var/lib/postgresql/data \
+ || awk '$5 == "/var/lib/postgresql/data" { found = 1 } END { exit !found }' /proc/self/mountinfo
+ }; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
diff --git a/postgres_alpine/docker-entrypoint.sh b/postgres_alpine/docker-entrypoint.sh
index c3432be..d4442d8 100755
--- a/postgres_alpine/docker-entrypoint.sh
+++ b/postgres_alpine/docker-entrypoint.sh
@@ -252,7 +252,12 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
- if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
+ if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && {
+ # in BusyBox, "mountpoint" only checks dev vs ino (https://github.com/tianon/mirror-busybox/blob/be7d1b7b1701d225379bc1665487ed0871b592a5/util-linux/mountpoint.c#L78) which will notably miss bind mounts entirely (which almost all Docker volume mounts are)
+ # coreutils checks /proc/self/mountinfo, so we have a fallback to mimic that and directly check "/proc/self/mountinfo" to catch that case
+ mountpoint -q /var/lib/postgresql/data \
+ || awk '$5 == "/var/lib/postgresql/data" { found = 1 } END { exit !found }' /proc/self/mountinfo
+ }; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
diff --git a/postgres_alpine3.22/docker-entrypoint.sh b/postgres_alpine3.22/docker-entrypoint.sh
index c3432be..d4442d8 100755
--- a/postgres_alpine3.22/docker-entrypoint.sh
+++ b/postgres_alpine3.22/docker-entrypoint.sh
@@ -252,7 +252,12 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
- if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
+ if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && {
+ # in BusyBox, "mountpoint" only checks dev vs ino (https://github.com/tianon/mirror-busybox/blob/be7d1b7b1701d225379bc1665487ed0871b592a5/util-linux/mountpoint.c#L78) which will notably miss bind mounts entirely (which almost all Docker volume mounts are)
+ # coreutils checks /proc/self/mountinfo, so we have a fallback to mimic that and directly check "/proc/self/mountinfo" to catch that case
+ mountpoint -q /var/lib/postgresql/data \
+ || awk '$5 == "/var/lib/postgresql/data" { found = 1 } END { exit !found }' /proc/self/mountinfo
+ }; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
diff --git a/postgres_bookworm/docker-entrypoint.sh b/postgres_bookworm/docker-entrypoint.sh
index c3432be..d4442d8 100755
--- a/postgres_bookworm/docker-entrypoint.sh
+++ b/postgres_bookworm/docker-entrypoint.sh
@@ -252,7 +252,12 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
- if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
+ if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && {
+ # in BusyBox, "mountpoint" only checks dev vs ino (https://github.com/tianon/mirror-busybox/blob/be7d1b7b1701d225379bc1665487ed0871b592a5/util-linux/mountpoint.c#L78) which will notably miss bind mounts entirely (which almost all Docker volume mounts are)
+ # coreutils checks /proc/self/mountinfo, so we have a fallback to mimic that and directly check "/proc/self/mountinfo" to catch that case
+ mountpoint -q /var/lib/postgresql/data \
+ || awk '$5 == "/var/lib/postgresql/data" { found = 1 } END { exit !found }' /proc/self/mountinfo
+ }; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fi
diff --git a/postgres_trixie/docker-entrypoint.sh b/postgres_trixie/docker-entrypoint.sh
index c3432be..d4442d8 100755
--- a/postgres_trixie/docker-entrypoint.sh
+++ b/postgres_trixie/docker-entrypoint.sh
@@ -252,7 +252,12 @@ docker_setup_env() {
OLD_DATABASES+=( "$d" )
fi
done
- if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && mountpoint -q /var/lib/postgresql/data; then
+ if [ "${#OLD_DATABASES[@]}" -eq 0 ] && [ "$PG_MAJOR" -ge 18 ] && {
+ # in BusyBox, "mountpoint" only checks dev vs ino (https://github.com/tianon/mirror-busybox/blob/be7d1b7b1701d225379bc1665487ed0871b592a5/util-linux/mountpoint.c#L78) which will notably miss bind mounts entirely (which almost all Docker volume mounts are)
+ # coreutils checks /proc/self/mountinfo, so we have a fallback to mimic that and directly check "/proc/self/mountinfo" to catch that case
+ mountpoint -q /var/lib/postgresql/data \
+ || awk '$5 == "/var/lib/postgresql/data" { found = 1 } END { exit !found }' /proc/self/mountinfo
+ }; then
OLD_DATABASES+=( '/var/lib/postgresql/data (unused mount/volume)' )
fi
fiRelevant Maintainers: |
tianon
approved these changes
Apr 21, 2026
Member
tianon
left a comment
There was a problem hiding this comment.
This BusyBox
mountpointworkaround looks correct -- field 5 of/proc/self/mountinfois indeed the canonical mount point path, so theawkfallback cleanly catches the bind-mount case that BusyBox's dev/ino check misses. The{ ... }grouping is a clean way to fold the two-part check into a single&&condition without a subshell. The inline comments explaining the why are a nice touch too. 👍
("claude my eyes right out")
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes:
/var/lib/postgresql/datamounts postgres#1409 from infosiftr/mountpoint-fallback/var/lib/postgresql/datamounts