From 2f432dcfb09331d53e6d153812eb5ae9d86c8902 Mon Sep 17 00:00:00 2001 From: "F.D.Castel" Date: Sun, 15 Nov 2026 12:21:42 +0000 Subject: [PATCH 1/2] docs(readme): document how to persist the security database with a bind mount (issue #53) --- README.md | 37 +++++++++++++++++++++++++++++++++++++ src/README.md.template | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/README.md b/README.md index 3f246fd..0ba2961 100644 --- a/README.md +++ b/README.md @@ -268,6 +268,43 @@ More information: +## Persisting the security database + +Firebird users are stored in the security database: `/opt/firebird/security5.fdb` (`security4.fdb` for Firebird 4, `security3.fdb` for Firebird 3). This includes users created with `FIREBIRD_USER`, with `CREATE USER`, or by your application. + +This file is part of the container, not of the `/var/lib/firebird/data` volume. It is kept when the container restarts, but a _new_ container (e.g. after `docker compose down` and `up`, or when upgrading the image) starts with the default security database of the image. Only `SYSDBA` and `FIREBIRD_USER` are then set up again. + +To keep your users, store the security database outside the container with a [Docker bind mount](https://docs.docker.com/engine/storage/bind-mounts/). Start from the default file of the image: + +```bash +# Extract the default security database from the image +docker create --name fb-tmp firebirdsql/firebird +docker cp fb-tmp:/opt/firebird/security5.fdb ./security5.fdb +docker rm fb-tmp + +# Use it with a bind mount +docker run -d --mount type=bind,src=$(pwd)/security5.fdb,dst=/opt/firebird/security5.fdb \ + -v ./data:/var/lib/firebird/data \ + -e FIREBIRD_ROOT_PASSWORD=my_secret_password firebirdsql/firebird +``` + +Or, with Docker Compose: + +```yaml + volumes: + - ./data:/var/lib/firebird/data + - ./security5.fdb:/opt/firebird/security5.fdb +``` + +> **IMPORTANT:** +> - The file must exist on the host before the container starts. With `-v` (or a Compose short syntax volume), a missing file is silently created as an empty _directory_, and Firebird cannot open the security database. `--mount` fails with an error instead. +> - Use the file name of the Firebird version you run, and extract it from an image of that same major version. +> - `/opt/firebird/SYSDBA.password` comes from the image and does not follow changes to your security database. Once the `SYSDBA` password in it changes (e.g. with `FIREBIRD_ROOT_PASSWORD`), a new container shows a password that no longer works. Set `FIREBIRD_ROOT_PASSWORD` on every start, or keep track of the `SYSDBA` password yourself. +> - When running as a non-root user, the file must be writable by that user (e.g. `chown 84:0 security5.fdb`). +> - Never use the same file in two containers running at the same time. + + + ## Using Firebird Events To use this image with [Firebird Events](https://firebirdsql.org/file/documentation/html/en/refdocs/fblangref50/firebird-50-language-reference.html#fblangref50-psql-postevent) you need to: diff --git a/src/README.md.template b/src/README.md.template index 5b6fdd0..ec66303 100644 --- a/src/README.md.template +++ b/src/README.md.template @@ -189,6 +189,43 @@ More information: +## Persisting the security database + +Firebird users are stored in the security database: `/opt/firebird/security5.fdb` (`security4.fdb` for Firebird 4, `security3.fdb` for Firebird 3). This includes users created with `FIREBIRD_USER`, with `CREATE USER`, or by your application. + +This file is part of the container, not of the `/var/lib/firebird/data` volume. It is kept when the container restarts, but a _new_ container (e.g. after `docker compose down` and `up`, or when upgrading the image) starts with the default security database of the image. Only `SYSDBA` and `FIREBIRD_USER` are then set up again. + +To keep your users, store the security database outside the container with a [Docker bind mount](https://docs.docker.com/engine/storage/bind-mounts/). Start from the default file of the image: + +```bash +# Extract the default security database from the image +docker create --name fb-tmp firebirdsql/firebird +docker cp fb-tmp:/opt/firebird/security5.fdb ./security5.fdb +docker rm fb-tmp + +# Use it with a bind mount +docker run -d --mount type=bind,src=$(pwd)/security5.fdb,dst=/opt/firebird/security5.fdb \ + -v ./data:/var/lib/firebird/data \ + -e FIREBIRD_ROOT_PASSWORD=my_secret_password firebirdsql/firebird +``` + +Or, with Docker Compose: + +```yaml + volumes: + - ./data:/var/lib/firebird/data + - ./security5.fdb:/opt/firebird/security5.fdb +``` + +> **IMPORTANT:** +> - The file must exist on the host before the container starts. With `-v` (or a Compose short syntax volume), a missing file is silently created as an empty _directory_, and Firebird cannot open the security database. `--mount` fails with an error instead. +> - Use the file name of the Firebird version you run, and extract it from an image of that same major version. +> - `/opt/firebird/SYSDBA.password` comes from the image and does not follow changes to your security database. Once the `SYSDBA` password in it changes (e.g. with `FIREBIRD_ROOT_PASSWORD`), a new container shows a password that no longer works. Set `FIREBIRD_ROOT_PASSWORD` on every start, or keep track of the `SYSDBA` password yourself. +> - When running as a non-root user, the file must be writable by that user (e.g. `chown 84:0 security5.fdb`). +> - Never use the same file in two containers running at the same time. + + + ## Using Firebird Events To use this image with [Firebird Events](https://firebirdsql.org/file/documentation/html/en/refdocs/fblangref50/firebird-50-language-reference.html#fblangref50-psql-postevent) you need to: From a135e5e45849c64e7116f559223c6f3041e10438 Mon Sep 17 00:00:00 2001 From: "F.D.Castel" Date: Sun, 15 Nov 2026 12:27:00 +0000 Subject: [PATCH 2/2] docs(readme): don't describe SYSDBA.password contents for a persisted security database --- README.md | 2 +- src/README.md.template | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0ba2961..e276256 100644 --- a/README.md +++ b/README.md @@ -299,7 +299,7 @@ Or, with Docker Compose: > **IMPORTANT:** > - The file must exist on the host before the container starts. With `-v` (or a Compose short syntax volume), a missing file is silently created as an empty _directory_, and Firebird cannot open the security database. `--mount` fails with an error instead. > - Use the file name of the Firebird version you run, and extract it from an image of that same major version. -> - `/opt/firebird/SYSDBA.password` comes from the image and does not follow changes to your security database. Once the `SYSDBA` password in it changes (e.g. with `FIREBIRD_ROOT_PASSWORD`), a new container shows a password that no longer works. Set `FIREBIRD_ROOT_PASSWORD` on every start, or keep track of the `SYSDBA` password yourself. +> - Do not rely on `/opt/firebird/SYSDBA.password`: it belongs to the container, not to your security database, and is not kept with it. Set `FIREBIRD_ROOT_PASSWORD` on every start, or keep track of the `SYSDBA` password yourself. > - When running as a non-root user, the file must be writable by that user (e.g. `chown 84:0 security5.fdb`). > - Never use the same file in two containers running at the same time. diff --git a/src/README.md.template b/src/README.md.template index ec66303..688971b 100644 --- a/src/README.md.template +++ b/src/README.md.template @@ -220,7 +220,7 @@ Or, with Docker Compose: > **IMPORTANT:** > - The file must exist on the host before the container starts. With `-v` (or a Compose short syntax volume), a missing file is silently created as an empty _directory_, and Firebird cannot open the security database. `--mount` fails with an error instead. > - Use the file name of the Firebird version you run, and extract it from an image of that same major version. -> - `/opt/firebird/SYSDBA.password` comes from the image and does not follow changes to your security database. Once the `SYSDBA` password in it changes (e.g. with `FIREBIRD_ROOT_PASSWORD`), a new container shows a password that no longer works. Set `FIREBIRD_ROOT_PASSWORD` on every start, or keep track of the `SYSDBA` password yourself. +> - Do not rely on `/opt/firebird/SYSDBA.password`: it belongs to the container, not to your security database, and is not kept with it. Set `FIREBIRD_ROOT_PASSWORD` on every start, or keep track of the `SYSDBA` password yourself. > - When running as a non-root user, the file must be writable by that user (e.g. `chown 84:0 security5.fdb`). > - Never use the same file in two containers running at the same time.