Docker
The server ships as container images for linux/amd64 and linux/arm64. Use them to run RasterizedDB without installing anything on the host, or as a service in Docker Compose. For complete, ready-to-run setups, see the Docker recipes.
Images and tags
Every release is pushed to Docker Hub as milendenev/rasterizeddb and to GitHub's registry as ghcr.io/milen-denev/rasterizeddb, with the same tags in both. The images hold the same server binary as the release archives.
| Tags | Base | Server build |
|---|---|---|
latest, <version>, <major>.<minor>, <major>, <version>-ubuntu24.04, ubuntu24.04 | Ubuntu 24.04 | glibc |
<version>-ubuntu26.04, <major>.<minor>-ubuntu26.04, ubuntu26.04 | Ubuntu 26.04 | glibc |
<version>-alpine, <major>.<minor>-alpine, alpine | Alpine 3 | static musl |
<version>-rustfs, <major>.<minor>-rustfs, rustfs | the official RustFS image | static musl, with RustFS S3 storage in the same container |
For example milendenev/rasterizeddb:1.1.0, milendenev/rasterizeddb:1.1-alpine or ghcr.io/milen-denev/rasterizeddb:rustfs. A release candidate gets only its exact tags (such as <version>-rc.1 and <version>-rc.1-alpine); latest and the short tags stay on the last full release. Pin an exact version in production.
The amd64 images need an AVX2 (x86-64-v3) CPU, like the release binaries.
Running a server
docker run -d --name rasterizeddb \
-e RASTERIZEDDB_PG_PASSWORD=change-me \
-p 5432:5432 -p 61170:61170 \
-v rasterizeddb:/var/lib/rasterizeddb \
milendenev/rasterizeddb:latestThen connect:
psql "host=localhost port=5432 user=rasterized dbname=postgres sslmode=require"What each part does:
-
RASTERIZEDDB_PG_PASSWORDis the password of the rolerasterized, which the server creates the first time it starts on an empty volume. It logs in over both protocols. Without it the native listener refuses to listen on the container's network and the container exits with that error. After the first start the variable is no longer read: change the password withALTER ROLE rasterized PASSWORD '…'(Security). -
Port 5432 is the PostgreSQL protocol; 61170 is the native protocol used by
rasterizeddb_client, the .NET client and Studio. Publish only what your clients use. -
TLS. The PostgreSQL protocol requires TLS by default, with a self-signed certificate made at every start, so clients use
sslmode=require. See your own certificate below. -
/var/lib/rasterizeddbis the data directory and a volume. The server runs as uid and gid 10001 in every image, so a volume moves between the Ubuntu, Alpine and RustFS variants. A bind-mounted host directory must be writable by uid 10001:shsudo install -d -o 10001 -g 10001 -m 700 /srv/rasterizeddb docker run -d --name rasterizeddb -e RASTERIZEDDB_PG_PASSWORD=change-me \ -p 5432:5432 -p 61170:61170 -v /srv/rasterizeddb:/var/lib/rasterizeddb \ milendenev/rasterizeddb:1.1.0
Passing server flags
The image's entrypoint is:
rasterizeddb --location /var/lib/rasterizeddb --protocol both --pg-addr 0.0.0.0 --rdb-addr 0.0.0.0Anything after the image name is appended to it, so any flag from Configuration can be added:
docker run -d --name rasterizeddb -e RASTERIZEDDB_PG_PASSWORD=change-me \
-p 5432:5432 -p 61170:61170 -p 3306:3306 \
-v rasterizeddb:/var/lib/rasterizeddb \
milendenev/rasterizeddb:latest \
--log-level warn --max-connections 200 --mysql-port 3306 --mysql-addr 0.0.0.0A listener you add (MySQL, SQL Server, Redis, replication) binds 127.0.0.1 unless you give its --…-addr 0.0.0.0 flag too, and it needs its port published.
docker run --rm milendenev/rasterizeddb:latest --help prints every flag. To change one of the entrypoint's own flags, replace the entrypoint and give the whole command:
docker run -d --name rasterizeddb -e RASTERIZEDDB_PG_PASSWORD=change-me \
-p 5432:5432 -v rasterizeddb:/var/lib/rasterizeddb \
--entrypoint rasterizeddb milendenev/rasterizeddb:latest \
--location /var/lib/rasterizeddb --protocol pgwire --pg-addr 0.0.0.0Your own certificate
Mount the certificate and key and point the server at them:
docker run -d --name rasterizeddb -e RASTERIZEDDB_PG_PASSWORD=change-me \
-p 5432:5432 -p 61170:61170 \
-v rasterizeddb:/var/lib/rasterizeddb \
-v /etc/rasterizeddb/certs:/certs:ro \
milendenev/rasterizeddb:latest \
--pg-cert /certs/server.crt --pg-key /certs/server.key \
--rdb-cert /certs/server.crt --rdb-key /certs/server.keyThe files must be readable by uid 10001. Add --pg-tls prefer to also accept cleartext PostgreSQL connections (sslmode=disable).
Compose
services:
rasterizeddb:
image: milendenev/rasterizeddb:1.1.0
environment:
RASTERIZEDDB_PG_PASSWORD: ${RASTERIZEDDB_PG_PASSWORD:?set it}
command: ["--log-level", "warn"]
ports:
- "5432:5432"
- "61170:61170"
volumes:
- rasterizeddb:/var/lib/rasterizeddb
stop_grace_period: 60s
restart: unless-stopped
volumes:
rasterizeddb:export RASTERIZEDDB_PG_PASSWORD='change-me'
docker compose up -d
docker compose logs -f rasterizeddbAnother service in the same Compose file reaches the server at rasterizeddb:5432, for example with the URL postgresql://rasterized:change-me@rasterizeddb:5432/postgres?sslmode=require.
Stopping and logs
docker stop sends SIGTERM, which shuts the server down cleanly: it drains sessions, writes index snapshots and checkpoints its log. Docker's default 10-second grace period is often too short for that; give it a minute with docker stop -t 60 or stop_grace_period: 60s. A container killed before it finishes loses nothing committed, but its next start replays the log and rebuilds indexes. See Stopping the server.
The server logs to standard error, which docker logs shows. The default level is error; add --log-level warn or info for more.
RustFS: backups and S3 tables in one container
The rustfs image runs RustFS, an S3-compatible object store, beside the server in one container. The server's backups and S3-backed tables are set up to use it.
docker run -d --name rasterizeddb \
-e RASTERIZEDDB_PG_PASSWORD=change-me \
-e RUSTFS_ACCESS_KEY=rdb-admin -e RUSTFS_SECRET_KEY=change-me-too \
-p 5432:5432 -p 61170:61170 \
-v rasterizeddb-db:/var/lib/rasterizeddb -v rasterizeddb-s3:/data \
milendenev/rasterizeddb:rustfsAt start, RustFS comes up first, the two buckets are created if missing, and then the server starts with:
-
Continuous backup to the bucket
rasterizeddb-backup: snapshots plus the archived log, soBACKUP DATABASE,SHOW BACKUPSand a point-in-time restore work at once. See Backup and restore. -
A table store named
rustfson the bucketrasterizeddb-tables. Place a table there before creating it to keep its rows in RustFS rather than in the data volume:sqlSTORAGE PLACE TABLE events AT 'kv:rustfs'; CREATE TABLE events (id BIGINT PRIMARY KEY, body TEXT);See Key/value storage.
The container prints rasterizeddb-rustfs: ready. once both are set up.
| Variable | Default | What it does |
|---|---|---|
RASTERIZEDDB_PG_PASSWORD | required | Password of the role rasterized, for both protocols. |
RUSTFS_ACCESS_KEY, RUSTFS_SECRET_KEY | required | RustFS's root credentials; the server signs its requests with them. RustFS's own default, rustfsadmin, is refused. |
RASTERIZEDDB_BACKUP_BUCKET | rasterizeddb-backup | Bucket for backups. |
RASTERIZEDDB_TABLES_BUCKET | rasterizeddb-tables | Bucket for S3-backed tables. Must differ from the backup bucket. |
RASTERIZEDDB_S3_STORE | rustfs | Name of the table store, as in kv:<name>. |
RASTERIZEDDB_S3_BACKUP | on | off leaves backups off. |
- Ports. 9000 is RustFS's S3 API and 9001 its web console. The server reaches RustFS inside the container, so publish them (
-p 9000:9000 -p 9001:9001) only if something outside needs them. - Volumes.
/var/lib/rasterizeddbholds the database and/dataRustFS's objects. A backup on the same disk as the database protects against a dropped table or a bad deploy, not a lost disk: put/dataon another disk, or copy the bucket elsewhere. - Stopping.
docker stopstops the server first, which still writes to RustFS while it shuts down, then RustFS. If either process exits on its own, the other is stopped too, so a restart policy brings both back. - Arguments after the image name go to the server, as with the other images.
Building an image yourself
The Dockerfiles in the repository's docker/ directory compile nothing: they copy a server binary from the build context.
git clone https://github.com/milen-denev/rasterizeddb.git
cd rasterizeddb
mkdir -p docker/bin/amd64
cp /path/to/rasterizeddb docker/bin/amd64/rasterizeddb
cp README.md LICENSE-GPL docker/
docker build --platform linux/amd64 -f docker/Dockerfile.ubuntu -t rasterizeddb-local dockerUse the glibc binary from a release archive, or one built on Ubuntu 24.04: a binary built on a newer distribution needs a newer glibc than the image has. Dockerfile.alpine and Dockerfile.rustfs read the static musl binary from docker/bin-musl/<amd64|arm64>/rasterizeddb instead.
Limits
- The images have no
HEALTHCHECK, and the Ubuntu and Alpine images contain nopsql. Check health from outside the container by running a query, for examplepsql "host=<host> user=rasterized dbname=postgres sslmode=require" -c 'SELECT 1'. - The
amd64images need an AVX2 CPU. - Unix sockets inside a container are only reachable through a shared volume; publish TCP ports instead.