Skip to content
Merged
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
2 changes: 1 addition & 1 deletion 14/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/bfren/alpine-s6:alpine3.20-7.0.1
FROM quay.io/bfren/alpine-s6:alpine3.20-7.0.2

LABEL org.opencontainers.image.source="https://github.com/bfren/docker-postgresql"

Expand Down
2 changes: 1 addition & 1 deletion 15/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/bfren/alpine-s6:alpine3.22-7.0.1
FROM quay.io/bfren/alpine-s6:alpine3.22-7.0.2

LABEL org.opencontainers.image.source="https://github.com/bfren/docker-postgresql"

Expand Down
2 changes: 1 addition & 1 deletion 16/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/bfren/alpine-s6:alpine3.24-7.0.1
FROM quay.io/bfren/alpine-s6:alpine3.24-7.0.2

LABEL org.opencontainers.image.source="https://github.com/bfren/docker-postgresql"

Expand Down
2 changes: 1 addition & 1 deletion 17/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/bfren/alpine-s6:alpine3.24-7.0.1
FROM quay.io/bfren/alpine-s6:alpine3.24-7.0.2

LABEL org.opencontainers.image.source="https://github.com/bfren/docker-postgresql"

Expand Down
2 changes: 1 addition & 1 deletion 18/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/bfren/alpine-s6:alpine3.24-7.0.1
FROM quay.io/bfren/alpine-s6:alpine3.24-7.0.2

LABEL org.opencontainers.image.source="https://github.com/bfren/docker-postgresql"

Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [6.0.2] - 2026-11-10

### Changed

- Base image updated to `bfren/alpine-s6` 7.0.2, which updates Nushell to 0.117.0 (your own Nushell scripts may
need changes), keeps the container starting when `BF_TZ` cannot be set, and no longer hides `CURRENT_FILE` and
`FILE_PWD` from services - see the
[Alpine + S6 changelog](https://github.com/bfren/docker-alpine-s6/blob/main/CHANGELOG.md).
- `BF_PG_DATABASE` accepts spaces as well as commas between database names, as `bfren/mariadb` does.
- The README now says to back up before running `pg-restore`: a restore deletes the current data before loading the
dump, and `psql` carries on past errors, so a bad dump leaves a partly restored cluster. Restores work as in 6.0.1.

## [6.0.1] - 2026-11-06

### Changed
Expand All @@ -31,5 +43,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
that much memory to back up.
- `pg-export dump` is refused - `/backup/dump.sql` would replace the whole cluster on the next start.

[6.0.2]: https://github.com/bfren/docker-postgresql/compare/v6.0.1...v6.0.2
[6.0.1]: https://github.com/bfren/docker-postgresql/compare/v6.0.0...v6.0.1
[6.0.0]: https://github.com/bfren/docker-postgresql/compare/v5.0.0...v6.0.0
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ Images are published to Docker Hub (`bfren/postgresql`) and Quay.io (`quay.io/bf
| `postgresqlN` | `postgresql18` | You want the latest image for a PostgreSQL version |
| `postgresqlN-MAJOR` | `postgresql18-6` | You want updates, but not breaking changes |
| `postgresqlN-MINOR` | `postgresql18-6.0` | You want fixes only - **recommended** |
| `postgresqlN-VERSION` | `postgresql18-6.0.1` | You want to pin this image exactly |
| `postgresqlN-VERSION` | `postgresql18-6.0.2` | You want to pin this image exactly |
| `postgresqlN.M` | `postgresql18.6` | You want an exact PostgreSQL release |
| `postgresqlN.M-VERSION` | `postgresql18.6-6.0.1` | You want to pin both |
| `postgresqlN.M-VERSION` | `postgresql18.6-6.0.2` | You want to pin both |

| PostgreSQL | Release | Alpine | Supported until |
| ---------- | ------- | ------ | --------------- |
Expand Down Expand Up @@ -100,7 +100,7 @@ Everything in the volumes is owned by `postgres` (UID / GID 1000), and only read
| `BF_PG_APPLICATION` | string | Default for `BF_PG_USERNAME`, `BF_PG_PASSWORD` and `BF_PG_DATABASE`. | |
| `BF_PG_USERNAME` | string | Application user - created on first start. | |
| `BF_PG_PASSWORD` | string | Application user's password - set on first start. | |
| `BF_PG_DATABASE` | names | Database(s) created on first start - separate several with commas. | |
| `BF_PG_DATABASE` | names | Database(s) created on first start - separate with commas or spaces. | |
| `BF_PG_BACKUP_COMPRESS_FILES` | `0`, `1` | Compress backup files with bzip2. | `0` |
| `BF_PG_BACKUP_KEEP_FOR` | [Nu duration](https://www.nushell.sh/book/types_of_data.html#durations) | How long to keep backups, e.g. `14day` or `8wk` (Nu has no months). | `28day` |

Expand Down Expand Up @@ -142,6 +142,8 @@ At a random minute every eight hours (00:xx, 08:xx and 16:xx in `BF_TZ`), `pg-du

`pg-restore <folder>` restores a backup folder's `dump.sql` (or `dump.sql.bz2`), e.g. `pg-restore 202610171608`. It **replaces the whole cluster**: PostgreSQL is stopped, `/data` is emptied, a new cluster is created from the dump, and PostgreSQL starts again.

**Back up first.** The current data is deleted before the dump is loaded, and `psql` carries on past errors - so a bad or incomplete dump leaves a partly restored cluster, with no way back to the data you had. Before restoring, run `pg-dump` (it saves the current cluster in a new backup folder), or stop the container and copy `/data` somewhere safe. The [upgrade steps](#version-check) below do this too.

You can also restore while the container is stopped: put `dump.sql` or `dump.sql.bz2` in the root of `/backup` and start the container. The dump file is renamed `dump.sql.restored` once it has been restored, and `psql`'s errors are saved to `dump.sql.log` - check `docker logs` for a warning that some statements failed.

### Export and import
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.0.1
6.0.2
2 changes: 1 addition & 1 deletion generate-dockerfiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -euo pipefail

docker pull bfren/alpine

BASE_VERSION="7.0.1"
BASE_VERSION="7.0.2"
echo "Base: ${BASE_VERSION}"

POSTGRESQL_VERSIONS="14 15 16 17 18"
Expand Down
4 changes: 2 additions & 2 deletions overlay/etc/nu/scripts/bf-postgresql/db.nu
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ export def get_all []: nothing -> list<string> {
{ ^pg psql -At -c $sql } | bf handle -d "Selecting PostgreSQL databases" db/get_all | lines | without_system
}

# Split a comma-separated list of database names (e.g. BF_PG_DATABASE), removing spaces and empty names
# Split a list of database names (e.g. BF_PG_DATABASE) separated by commas and / or spaces, removing empty names
export def names []: string -> list<string> {
split row "," | str trim | where {|x| $x != "" }
split row --regex '[\s,]+' | where {|x| $x != "" }
}

# Remove system databases and empty values from a list of database names
Expand Down
4 changes: 4 additions & 0 deletions overlay/etc/nu/scripts/tests/db.nu
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ export def names__splits_on_commas_and_removes_spaces [] {
assert equal ["one" "two" "three"] ("one, two ,three" | db names)
}

export def names__splits_on_spaces [] {
assert equal ["one" "two" "three"] ("one two three" | db names)
}

export def names__ignores_empty_names [] {
assert equal ["one"] ("one,, ," | db names)
assert equal [] ("" | db names)
Expand Down
Loading