diff --git a/14/Dockerfile b/14/Dockerfile index 64ee82e..c8be7b0 100644 --- a/14/Dockerfile +++ b/14/Dockerfile @@ -1,4 +1,4 @@ -FROM quay.io/bfren/alpine-s6:alpine3.20-7.0.2 +FROM quay.io/bfren/alpine-s6:alpine3.20-7.0.3 LABEL org.opencontainers.image.source="https://github.com/bfren/docker-postgresql" diff --git a/15/Dockerfile b/15/Dockerfile index 658b9b4..55f6cfd 100644 --- a/15/Dockerfile +++ b/15/Dockerfile @@ -1,4 +1,4 @@ -FROM quay.io/bfren/alpine-s6:alpine3.22-7.0.2 +FROM quay.io/bfren/alpine-s6:alpine3.22-7.0.3 LABEL org.opencontainers.image.source="https://github.com/bfren/docker-postgresql" diff --git a/15/overlay/tmp/POSTGRESQL_BUILD b/15/overlay/tmp/POSTGRESQL_BUILD index 4f7accd..d2f3bc3 100644 --- a/15/overlay/tmp/POSTGRESQL_BUILD +++ b/15/overlay/tmp/POSTGRESQL_BUILD @@ -1 +1 @@ -15.19-r0 \ No newline at end of file +15.20-r0 \ No newline at end of file diff --git a/15/overlay/tmp/POSTGRESQL_MINOR b/15/overlay/tmp/POSTGRESQL_MINOR index 77d7e69..88378e1 100644 --- a/15/overlay/tmp/POSTGRESQL_MINOR +++ b/15/overlay/tmp/POSTGRESQL_MINOR @@ -1 +1 @@ -15.19 \ No newline at end of file +15.20 \ No newline at end of file diff --git a/16/Dockerfile b/16/Dockerfile index 9caeff7..cce36f8 100644 --- a/16/Dockerfile +++ b/16/Dockerfile @@ -1,4 +1,4 @@ -FROM quay.io/bfren/alpine-s6:alpine3.24-7.0.2 +FROM quay.io/bfren/alpine-s6:alpine3.24-7.0.3 LABEL org.opencontainers.image.source="https://github.com/bfren/docker-postgresql" diff --git a/16/overlay/tmp/POSTGRESQL_BUILD b/16/overlay/tmp/POSTGRESQL_BUILD index 53a6b44..3ce85a2 100644 --- a/16/overlay/tmp/POSTGRESQL_BUILD +++ b/16/overlay/tmp/POSTGRESQL_BUILD @@ -1 +1 @@ -16.15-r0 \ No newline at end of file +16.16-r0 \ No newline at end of file diff --git a/16/overlay/tmp/POSTGRESQL_MINOR b/16/overlay/tmp/POSTGRESQL_MINOR index 37cda8c..dc79191 100644 --- a/16/overlay/tmp/POSTGRESQL_MINOR +++ b/16/overlay/tmp/POSTGRESQL_MINOR @@ -1 +1 @@ -16.15 \ No newline at end of file +16.16 \ No newline at end of file diff --git a/17/Dockerfile b/17/Dockerfile index 9f09099..8fff5f5 100644 --- a/17/Dockerfile +++ b/17/Dockerfile @@ -1,4 +1,4 @@ -FROM quay.io/bfren/alpine-s6:alpine3.24-7.0.2 +FROM quay.io/bfren/alpine-s6:alpine3.24-7.0.3 LABEL org.opencontainers.image.source="https://github.com/bfren/docker-postgresql" diff --git a/17/overlay/tmp/POSTGRESQL_BUILD b/17/overlay/tmp/POSTGRESQL_BUILD index 0b59b3a..b1e54a9 100644 --- a/17/overlay/tmp/POSTGRESQL_BUILD +++ b/17/overlay/tmp/POSTGRESQL_BUILD @@ -1 +1 @@ -17.11-r0 \ No newline at end of file +17.12-r0 \ No newline at end of file diff --git a/17/overlay/tmp/POSTGRESQL_MINOR b/17/overlay/tmp/POSTGRESQL_MINOR index ddb9a6c..85ad71d 100644 --- a/17/overlay/tmp/POSTGRESQL_MINOR +++ b/17/overlay/tmp/POSTGRESQL_MINOR @@ -1 +1 @@ -17.11 \ No newline at end of file +17.12 \ No newline at end of file diff --git a/18/Dockerfile b/18/Dockerfile index 59cab6c..f44deb5 100644 --- a/18/Dockerfile +++ b/18/Dockerfile @@ -1,4 +1,4 @@ -FROM quay.io/bfren/alpine-s6:alpine3.24-7.0.2 +FROM quay.io/bfren/alpine-s6:alpine3.24-7.0.3 LABEL org.opencontainers.image.source="https://github.com/bfren/docker-postgresql" diff --git a/18/overlay/tmp/POSTGRESQL_BUILD b/18/overlay/tmp/POSTGRESQL_BUILD index e250cfc..8b250f7 100644 --- a/18/overlay/tmp/POSTGRESQL_BUILD +++ b/18/overlay/tmp/POSTGRESQL_BUILD @@ -1 +1 @@ -18.6-r0 \ No newline at end of file +18.7-r0 \ No newline at end of file diff --git a/18/overlay/tmp/POSTGRESQL_MINOR b/18/overlay/tmp/POSTGRESQL_MINOR index d86a139..ce89f2a 100644 --- a/18/overlay/tmp/POSTGRESQL_MINOR +++ b/18/overlay/tmp/POSTGRESQL_MINOR @@ -1 +1 @@ -18.6 \ No newline at end of file +18.7 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index a03d33c..af071cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,22 @@ 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.3] - 2026-11-25 + +### Changed + +- Base image updated to `bfren/alpine-s6` 7.0.3, which rebuilds BusyBox, figlet and Nushell without changing + their versions - see the [Alpine + S6 changelog](https://github.com/bfren/docker-alpine-s6/blob/main/CHANGELOG.md). +- PostgreSQL updated to 15.20, 16.16, 17.12 and 18.7. + +### Fixed + +- README: said your changes to `postgresql.conf` and `pg_hba.conf` are always kept - a restore writes them again, so + copy them first. +- README: changing the password and moving a database between containers are now lists of steps, and the helper commands + table shows how to run each command. +- `docker-compose.yml` now matches the README Quickstart - it used PostgreSQL 16 and no password. + ## [6.0.2] - 2026-11-10 ### Changed @@ -43,6 +59,7 @@ 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.3]: https://github.com/bfren/docker-postgresql/compare/v6.0.2...v6.0.3 [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 diff --git a/README.md b/README.md index 5d498bc..9702669 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,8 @@ services: - ./v/backup:/backup ``` +This example is also in [`docker-compose.yml`](docker-compose.yml). + `.env` (keep it out of version control): ```sh @@ -60,16 +62,18 @@ 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.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.2` | You want to pin both | +| `postgresqlN-VERSION` | `postgresql18-6.0.3` | You want to pin this image exactly | +| `postgresqlN.M` | `postgresql18.7` | You want an exact PostgreSQL release | +| `postgresqlN.M-VERSION` | `postgresql18.7-6.0.3` | You want to pin both | + +A new `MAJOR` version means a breaking change. Before moving to one, read the [changelog](CHANGELOG.md), where each breaking change is marked **Breaking**. | PostgreSQL | Release | Alpine | Supported until | | ---------- | ------- | ------ | --------------- | -| 18 | 18.6 | 3.24 | November 2030 | -| 17 | 17.11 | 3.24 | November 2029 | -| 16 | 16.15 | 3.24 | November 2028 | -| 15 | 15.19 | 3.22 | November 2027 | +| 18 | 18.7 | 3.24 | November 2030 | +| 17 | 17.12 | 3.24 | November 2029 | +| 16 | 16.16 | 3.24 | November 2028 | +| 15 | 15.20 | 3.22 | November 2027 | | 14 | 14.17 | 3.20 | November 2026 | PostgreSQL supports each major version for five years - see the [versioning policy](https://www.postgresql.org/support/versioning/). Older versions still work, but get no more fixes: use them only to get existing data out. @@ -127,7 +131,7 @@ This only happens once. Changing the variables later does **not** change the pas * Inside the container, any user can connect without a password (`trust`) - this is how the helper commands work. * From other containers and machines, users need a password (`scram-sha-256`), over IPv4 or IPv6. -To change these rules or tune PostgreSQL (e.g. `shared_buffers`), edit `/data/postgresql.conf` or `/data/pg_hba.conf` and restart the container. They are only generated when a cluster is created, so your changes are kept. The server time zone is set to `GB`. +To change these rules or tune PostgreSQL (e.g. `shared_buffers`), edit `/data/postgresql.conf` or `/data/pg_hba.conf` and restart the container. They are only generated when a cluster is created, so your changes are kept across restarts - but a [restore](#restore) creates a new cluster and writes them again, so copy your changes somewhere first and put them back afterwards. The server time zone is set to `GB`. ### Backups @@ -151,7 +155,11 @@ You can also restore while the container is stopped: put `dump.sql` or `dump.sql * `pg-export ` saves `/backup/.sql` - except for a database called `dump`, because `/backup/dump.sql` is restored over the whole cluster on the next start. * `pg-import ` runs `/backup/.sql` in that database, creating it (owned by the application user) if it doesn't exist. Files from `pg-export` and the per-database backup files drop and recreate the tables they contain. -To move a database between containers, `pg-export` in one, copy the file to the other's `/backup`, then `pg-import`. +To move a database between containers: + +1. In the old container, run `pg-export `. +2. Copy `/backup/.sql` into the new container's `/backup` volume. +3. In the new container, run `pg-import `. ### Version check @@ -166,15 +174,15 @@ To upgrade to a newer major version, move the data across in a dump: ### Helper commands -Run these with `docker exec `. +Run these with `docker exec `, e.g. `docker exec db pg-dump`. Interactive commands need `-it`: `docker exec -it db pg psql`. -| Command | Arguments | Description | -| ------------ | --------- | ------------------------------------------------------------------------- | -| `pg` | command | Run a command as `postgres`, e.g. `pg psql` (add `-it` to `docker exec`). | -| `pg-dump` | | Back up now. | -| `pg-restore` | folder | Replace the cluster with a backup folder's dump. | -| `pg-export` | database | Save a database to `/backup/.sql`. | -| `pg-import` | database | Run `/backup/.sql`, creating the database if needed. | +| Command | Description | +| ---------------------- | --------------------------------------------------------------------------- | +| `pg ` | Run a command as `postgres`, e.g. `pg psql`. | +| `pg-dump` | Back up now. | +| `pg-restore ` | Replace the whole cluster with a backup folder's dump, e.g. `202610171608`. | +| `pg-export ` | Save a database to `/backup/.sql`. | +| `pg-import ` | Run `/backup/.sql`, creating the database if needed. | ### Health check @@ -203,7 +211,10 @@ Check `docker logs `: ### I changed the password but can't log in -The password is only set on [first start](#first-start). Change it with `docker exec -it pg psql -c "ALTER USER myapp PASSWORD 'new';"`, then update `BF_PG_PASSWORD` to match. +The password is only set on [first start](#first-start), so changing the variable alone does nothing. To change it: + +1. Run `docker exec pg psql -c "ALTER USER myapp PASSWORD 'new-password';"`. Inside the container no password is needed, so this works whatever the old one was. +2. Update `BF_PG_PASSWORD` to match, so it is right if you ever start again with an empty `/data`. ### Another container can't connect diff --git a/VERSION b/VERSION index 7a9f89d..39c5d6a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.0.2 \ No newline at end of file +6.0.3 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 96fc85d..b260ed5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,19 +1,10 @@ services: - pgsql: - image: bfren/postgresql:postgresql16 - container_name: pgsql + db: + image: quay.io/bfren/postgresql:postgresql18-6.0 restart: unless-stopped environment: - - BF_PG_BACKUP_COMPRESS_FILES=1 - - BF_PG_BACKUP_KEEP_FOR=56day - - BF_PG_APPLICATION=test + - BF_PG_APPLICATION=myapp + - BF_PG_PASSWORD=${DB_PASSWORD} volumes: - - ./v/db:/data - - ./v/db-backup:/backup - networks: - - pgsql - -networks: - pgsql: - driver: bridge - name: pgsql + - ./v/data:/data + - ./v/backup:/backup diff --git a/generate-dockerfiles.sh b/generate-dockerfiles.sh index 6ee8c3e..6dd3261 100755 --- a/generate-dockerfiles.sh +++ b/generate-dockerfiles.sh @@ -4,7 +4,7 @@ set -euo pipefail docker pull bfren/alpine -BASE_VERSION="7.0.2" +BASE_VERSION="7.0.3" echo "Base: ${BASE_VERSION}" POSTGRESQL_VERSIONS="14 15 16 17 18"