Single container
Run the RasterizedDB server in one container with docker run, its data on a named volume. Use it to try the server or to run one instance on a host without Compose. The scripts below do the same thing on Linux and macOS (run.sh) and on Windows (run.ps1).
What you get
- The server on the PostgreSQL protocol (port 5432) and the native protocol (port 61170, used by
rasterizeddb_clientand RasterizedDB Studio), both on one catalogue. - A superuser role named
rasterizedwith the password you choose. - Data on the volume
rasterizeddb-data, kept across restarts and container rebuilds. - A restart policy (
unless-stopped) and 60 seconds for a clean shutdown ondocker stop. - Ports published on
127.0.0.1only, until you choose otherwise.
Prerequisites
- Docker Engine or Docker Desktop.
- On x86-64, a CPU with AVX2 (x86-64-v3). The
linux/arm64image has no such requirement. - To check the result:
psql(any recent PostgreSQL client), or thepostgres:17image, which contains it.
The image
The images are published on Docker Hub as milendenev/rasterizeddb and on GitHub as ghcr.io/milen-denev/rasterizeddb, with the same tags in both, for linux/amd64 and linux/arm64.
| Tag | Base |
|---|---|
1.1.0, 1.1, 1, latest, 1.1.0-ubuntu24.04, 1.1-ubuntu24.04, ubuntu24.04 | Ubuntu 24.04 |
1.1.0-ubuntu26.04, 1.1-ubuntu26.04, ubuntu26.04 | Ubuntu 26.04 |
1.1.0-alpine, 1.1-alpine, alpine | Alpine, with a static build of the server |
1.1.0-rustfs, 1.1-rustfs, rustfs | the server with RustFS object storage beside it (see RustFS all-in-one) |
What every image does:
| Command | 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 added to it. |
| Data | /var/lib/rasterizeddb, declared as a volume |
| Ports | 5432 (PostgreSQL protocol), 61170 (native protocol) |
| User | uid and gid 10001, in every variant, so a volume moves between them |
| Password | RASTERIZEDDB_PG_PASSWORD, the password of the role rasterized |
| Stop signal | SIGTERM, a clean shutdown |
The scripts pin 1.1.0. Pin a full version in anything you deploy, so a restart never changes the version under you. See Upgrading.
What to edit
Set the password in the environment before you run a script. The scripts read it from there, so it never appears on the docker command line.
| Setting | run.sh (environment) | run.ps1 (parameter) | Default |
|---|---|---|---|
| Password, required | RASTERIZEDDB_PG_PASSWORD | $env:RASTERIZEDDB_PG_PASSWORD | none |
| Image | IMAGE | -Image | milendenev/rasterizeddb:1.1.0 |
| Container name | NAME | -Name | rasterizeddb |
| Data volume | VOLUME | -Volume | rasterizeddb-data |
| Host address for the ports | BIND | -Bind | 127.0.0.1 |
Set BIND=0.0.0.0 (or -Bind 0.0.0.0) to accept connections from other machines. Read Security before you do.
The password is used once, on the first start, to create the role rasterized. Changing the variable later does nothing. To change the password of a running server, connect and run:
ALTER ROLE rasterized PASSWORD 'the-new-password';Run it
Linux and macOS:
export RASTERIZEDDB_PG_PASSWORD='a-long-random-password'
./run.shWindows:
$env:RASTERIZEDDB_PG_PASSWORD = 'a-long-random-password'
.\run.ps1Server flags go after the script name (run.sh) or in -ServerArgs (run.ps1), and are added to the image's own. For example, more log output and a lower connection limit:
./run.sh --log-level info --max-connections 200.\run.ps1 -ServerArgs '--log-level', 'info', '--max-connections', '200'docker run --rm milendenev/rasterizeddb:1.1.0 --help lists every server flag. See Configuration for what they do.
Check that it works
psql "host=127.0.0.1 port=5432 user=rasterized dbname=postgres sslmode=require" -c "SELECT 1 AS ok" ok
----
1
(1 row)The PostgreSQL protocol requires TLS by default, with a self-signed certificate made at start-up, so clients connect with sslmode=require. To use your own certificate, see Compose with TLS.
Without psql on the host, run it from the postgres:17 image inside the server's network namespace:
docker run --rm -it --network container:rasterizeddb -e PGPASSWORD="$RASTERIZEDDB_PG_PASSWORD" postgres:17 \
psql "host=127.0.0.1 port=5432 user=rasterized dbname=postgres sslmode=require"If the container is not running, read why:
docker logs rasterizeddbA container started without a password exits straight away and says so in its log: the server refuses to listen beyond loopback without one.
Stop and clean up
Stop and start again (the data stays):
docker stop -t 60 rasterizeddb
docker start rasterizeddbRemove the container. The data stays on the volume, and running the script again picks it up:
docker rm -f rasterizeddbRemove the data too. This deletes the database for good:
docker rm -f rasterizeddb
docker volume rm rasterizeddb-dataLimits
- This recipe has no healthcheck, so nothing reports when the server is ready. Compose basic adds one.
- A bind-mounted host directory works instead of a volume only if uid 10001 can write to it.
docker stopwithout-tgives the server 10 seconds. The scripts set 60 for the container, so plaindocker stopuses that.
The files
#!/usr/bin/env bash
# Starts one RasterizedDB container with its data on a named volume.
#
# export RASTERIZEDDB_PG_PASSWORD='a-long-random-password'
# ./run.sh # default flags
# ./run.sh --log-level warn # anything after the script name goes to the server
#
# Settings (environment variables, all optional except the password):
# IMAGE image and tag (default milendenev/rasterizeddb:1.1.0)
# NAME container name (default rasterizeddb)
# VOLUME data volume (default rasterizeddb-data)
# BIND host address to publish (default 127.0.0.1; 0.0.0.0 for every interface)
set -euo pipefail
IMAGE="${IMAGE:-milendenev/rasterizeddb:1.1.0}"
NAME="${NAME:-rasterizeddb}"
VOLUME="${VOLUME:-rasterizeddb-data}"
BIND="${BIND:-127.0.0.1}"
if [ -z "${RASTERIZEDDB_PG_PASSWORD:-}" ]; then
echo "Set RASTERIZEDDB_PG_PASSWORD first: it becomes the password of the role 'rasterized'." >&2
exit 1
fi
docker volume create "$VOLUME" >/dev/null
# -e RASTERIZEDDB_PG_PASSWORD (no value) copies it from this shell, so the
# password is not written on the docker command line.
docker run -d \
--name "$NAME" \
--restart unless-stopped \
--stop-timeout 60 \
-e RASTERIZEDDB_PG_PASSWORD \
-p "$BIND:5432:5432" \
-p "$BIND:61170:61170" \
-v "$VOLUME:/var/lib/rasterizeddb" \
"$IMAGE" "$@"
echo "Started $NAME from $IMAGE."
echo "Connect: psql \"host=127.0.0.1 port=5432 user=rasterized dbname=postgres sslmode=require\""# Starts one RasterizedDB container with its data on a named volume.
#
# $env:RASTERIZEDDB_PG_PASSWORD = 'a-long-random-password'
# .\run.ps1 # default flags
# .\run.ps1 -ServerArgs '--log-level', 'warn' # server flags, after the image's own
# .\run.ps1 -Bind 0.0.0.0 # publish on every interface
param(
[string] $Image = 'milendenev/rasterizeddb:1.1.0',
[string] $Name = 'rasterizeddb',
[string] $Volume = 'rasterizeddb-data',
[string] $Bind = '127.0.0.1',
[Parameter(ValueFromRemainingArguments = $true)]
[string[]] $ServerArgs
)
$ErrorActionPreference = 'Stop'
if (-not $env:RASTERIZEDDB_PG_PASSWORD) {
throw "Set `$env:RASTERIZEDDB_PG_PASSWORD first: it becomes the password of the role 'rasterized'."
}
docker volume create $Volume | Out-Null
if ($LASTEXITCODE -ne 0) { throw "docker volume create $Volume failed" }
# -e RASTERIZEDDB_PG_PASSWORD (no value) copies it from this session, so the
# password is not written on the docker command line.
$runArgs = @(
'run', '-d',
'--name', $Name,
'--restart', 'unless-stopped',
'--stop-timeout', '60',
'-e', 'RASTERIZEDDB_PG_PASSWORD',
'-p', "${Bind}:5432:5432",
'-p', "${Bind}:61170:61170",
'-v', "${Volume}:/var/lib/rasterizeddb",
$Image
)
if ($ServerArgs) { $runArgs += $ServerArgs }
docker @runArgs
if ($LASTEXITCODE -ne 0) { throw "docker run failed" }
Write-Host "Started $Name from $Image."
Write-Host 'Connect: psql "host=127.0.0.1 port=5432 user=rasterized dbname=postgres sslmode=require"'