NEW RasterizedDB 1.1.0 is out: sharding and the gateway, the message broker, roles and row-level security, compression, .NET on NuGet, and the enterprise edition. What's new ›

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.

TagsBaseServer build
latest, <version>, <major>.<minor>, <major>, <version>-ubuntu24.04, ubuntu24.04Ubuntu 24.04glibc
<version>-ubuntu26.04, <major>.<minor>-ubuntu26.04, ubuntu26.04Ubuntu 26.04glibc
<version>-alpine, <major>.<minor>-alpine, alpineAlpine 3static musl
<version>-rustfs, <major>.<minor>-rustfs, rustfsthe official RustFS imagestatic 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

sh
docker run -d --name rasterizeddb \
  -e RASTERIZEDDB_PG_PASSWORD=change-me \
  -p 5432:5432 -p 61170:61170 \
  -v rasterizeddb:/var/lib/rasterizeddb \
  milendenev/rasterizeddb:latest

Then connect:

sh
psql "host=localhost port=5432 user=rasterized dbname=postgres sslmode=require"

What each part does:

  • RASTERIZEDDB_PG_PASSWORD is the password of the role rasterized, 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 with ALTER 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/rasterizeddb is 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:

    sh
    sudo 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:

text
rasterizeddb --location /var/lib/rasterizeddb --protocol both --pg-addr 0.0.0.0 --rdb-addr 0.0.0.0

Anything after the image name is appended to it, so any flag from Configuration can be added:

sh
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.0

A 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:

sh
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.0

Your own certificate

Mount the certificate and key and point the server at them:

sh
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.key

The files must be readable by uid 10001. Add --pg-tls prefer to also accept cleartext PostgreSQL connections (sslmode=disable).

Compose

yaml
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:
sh
export RASTERIZEDDB_PG_PASSWORD='change-me'
docker compose up -d
docker compose logs -f rasterizeddb

Another 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.

sh
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:rustfs

At 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, so BACKUP DATABASE, SHOW BACKUPS and a point-in-time restore work at once. See Backup and restore.

  • A table store named rustfs on the bucket rasterizeddb-tables. Place a table there before creating it to keep its rows in RustFS rather than in the data volume:

    sql
    STORAGE 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.

VariableDefaultWhat it does
RASTERIZEDDB_PG_PASSWORDrequiredPassword of the role rasterized, for both protocols.
RUSTFS_ACCESS_KEY, RUSTFS_SECRET_KEYrequiredRustFS's root credentials; the server signs its requests with them. RustFS's own default, rustfsadmin, is refused.
RASTERIZEDDB_BACKUP_BUCKETrasterizeddb-backupBucket for backups.
RASTERIZEDDB_TABLES_BUCKETrasterizeddb-tablesBucket for S3-backed tables. Must differ from the backup bucket.
RASTERIZEDDB_S3_STORErustfsName of the table store, as in kv:<name>.
RASTERIZEDDB_S3_BACKUPonoff 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/rasterizeddb holds the database and /data RustFS'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 /data on another disk, or copy the bucket elsewhere.
  • Stopping. docker stop stops 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.

sh
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 docker

Use 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 no psql. Check health from outside the container by running a query, for example psql "host=<host> user=rasterized dbname=postgres sslmode=require" -c 'SELECT 1'.
  • The amd64 images need an AVX2 CPU.
  • Unix sockets inside a container are only reachable through a shared volume; publish TCP ports instead.
✓ page rendered in 177 µs axum + tera + htmx · no other javascript