Firebird is a powerful open-source SQL database, and thanks to Docker, getting it up and running locally is a breeze. In this guide, we’ll walk through installing Firebird in a Docker container using the official image demonstrate how to configure persistence, initialize databases, and connect to it. Let’s dive in!
1. Choose the Right Docker Image
The official Firebird Docker images are hosted at
firebirdsql/firebird on Docker Hub, maintained by the Firebird Project and FD Castel.
They include versions based on v3, v4, and above:
docker pull firebirdsql/firebird:latest
The repo supports automatic restoration of backups placed in
/firebird/restore
, which simplifies initializing containers
github.com.
2. Run Firebird in Docker
Here’s a basic
docker run
command:
docker run -d \
--name firebird \
-p 3050:3050 \
-e ISC_PASSWORD=masterkey \
firebirdsql/firebird:latest
ISC_PASSWORD
: sets the SYSDBA
password.
- Port
3050
is where the Firebird server listens.
On startup, a sample database appears under
/firebird/data
.
3. Use Docker Compose for Persistence
For persistent storage and easy volume management, try this
docker-compose.yml
:
version: '3'
services:
firebird:
image: firebirdsql/firebird:latest
container_name: firebird
ports:
- "3050:3050"
environment:
ISC_PASSWORD: masterkey
volumes:
- ./fb-data:/firebird/data
- ./fb-backups:/firebird/restore
fb-data
: stores live database files.
fb-backups
: drop .fbk
files here; Firebird auto-restores them if /firebird/data
lacks them.
Start it with:
docker-compose up -d
4. Initialize a Database
To initialize manually or test:
docker exec -it firebird bash
isql-fb \
-u SYSDBA \
-p masterkey \
/firebird/data/yourdb.fdb
Inside
isql-fb
, run SQL:
CREATE TABLE test(x INT);
COMMIT;
The
.fdb
file now exists in
/firebird/data
.
5. Connect from Applications
Use JDBC with Jaybird or other drivers. A typical connection string looks like:
jdbc:firebirdsql://localhost:3050//firebird/data/yourdb.fdb
Important: on Unix-like systems, file paths must include the leading
/
, sometimes requiring double slashes after the port
6. Customize Configuration
The image supports some environment variables:
FIREBIRD_DATABASE
, FIREBIRD_USER
, FIREBIRD_PASSWORD
: auto-creates user and DB.
ISC_PASSWORD
: sets SYSDBA password.
EnableWireCrypt
, DataTypeCompatibility
, etc.: control compatibility, authentication, and encryption
For example:
environment:
ISC_PASSWORD: masterkey
FIREBIRD_DATABASE: sampledb.fdb
FIREBIRD_USER: appuser
FIREBIRD_PASSWORD: apppass
This automates creating a ready-to-use DB.
image quote pre code