Citus distributed PostgreSQL: multi-arch, non-root, password auth, every Citus line, signed
1.1K
Questions about this image? We build and test it, and we answer every email ourselves, usually within two days. Ask about upgrades, configuration, hardened or custom images, or anything else. A one-line question is fine: [email protected]
Multi-arch (amd64, arm64) and signed Citus Docker image for every maintained Citus release line: 14.3 on PostgreSQL 16, 17 and 18, 13.5 on PostgreSQL 16 and 17, and 12.1 on PostgreSQL 15 and 16. Citus turns PostgreSQL into a distributed database: tables are sharded across worker nodes, and queries run in parallel. This image runs a Citus cluster without trust auth: nodes log in to each other with a password and TLS. Workers add themselves to the coordinator, so no extra manager container or Docker socket is needed. Online rebalancing works out of the box, and the container runs as non-root. It works with Docker, Docker Compose and Kubernetes, and is a drop-in alternative to the official citusdata/citus image, with the same tag names.
Community-maintained by upstreamyard. This is not an official Citus image. Citus is licensed under AGPL-3.0 (see Licences).
| Registry | Image |
|---|---|
| Docker Hub | upstreamyard/citus |
| GitHub Container Registry | ghcr.io/upstreamyard/citus |
| Tag | Citus | PostgreSQL |
|---|---|---|
14.3.0, 14.3, 14, latest | 14.3.x, the newest line | 18 |
14.3.0-pg17, 14.3-pg17, 14-pg17 | 14.3.x | 17 |
14.3.0-pg16, 14.3-pg16, 14-pg16 | 14.3.x | 16 |
13.5.0, 13.5, 13 | 13.5.x | 17 |
13.5.0-pg16, 13.5-pg16, 13-pg16 | 13.5.x | 16 |
12.1.14, 12.1, 12 | 12.1.x | 16 |
12.1.14-pg15, 12.1-pg15, 12-pg15 | 12.1.x | 15 |
<citus>-pg<postgres>, e.g. 14.3.0-pg18.7 | fixed Citus version | fixed PostgreSQL minor version |
Citus 13.5.0 doesn't compile against PostgreSQL 15.20 (Citus issue #8976), so there is no 13.5.0-pg15; on PostgreSQL 15, use 12.1-pg15 until a fixed 13.5 release is out, which is then built automatically.
New Citus releases are built within 24 hours. Images are also rebuilt when the official PostgreSQL base image changes (new PostgreSQL minor release or Debian security fixes). Tags without a PostgreSQL minor version (14.3, 14.3-pg17) follow those rebuilds. Pin the PostgreSQL major version (14.3-pg18, not latest): a PostgreSQL major upgrade needs pg_upgrade, not just a new image.
Compared with the official citusdata/citus image. We checked its Docker Hub tags and ran citusdata/citus:14.2.0 on 2026-11-29.
citusdata/citus | upstreamyard/citus | |
|---|---|---|
| Newest Citus 14 | 14.2.0 (14.3.0 was released 2026-10-23) | 14.3.0 |
| Older release lines | newest tags 13.2.0 and 12.1.6 | 13.5.0 and 12.1.14, the current releases |
| arm64 (Graviton, Apple silicon) | only the floating alpine tag; versioned tags are amd64 only | every tag |
| Runs as | starts as root, then switches to UID 999 | UID 10001 from the start; read-only root filesystem works |
| Login between nodes | PGPASSWORD in the environment or trust; its docker-compose.yml defaults to POSTGRES_HOST_AUTH_METHOD=trust | password (scram-sha-256) from a generated password file, TLS 1.3 |
| Adding workers in Compose | a membership-manager container with the Docker socket mounted | workers register themselves (CITUS_COORDINATOR_HOST) |
Online rebalance and citus_drain_node | fail: logical decoding requires "wal_level" >= "logical" | wal_level = logical by default; tested under writes |
| Extensions | citus, hll, topn | citus, hll, topn, pgvector, pg_cron |
| Signed, SBOM, provenance | no (single-platform manifest without attestations or signature) | cosign, SBOM, SLSA provenance |
| Port | 5432 |
| Probe | healthcheck (in PATH): pg_isready over TCP. Stays unhealthy while a new data directory is initialised |
| Requires | nothing for a single node. A cluster is one coordinator plus workers, all from this image, with the same POSTGRES_USER, POSTGRES_PASSWORD and POSTGRES_DB |
| Storage | PostgreSQL 18: mount /var/lib/postgresql (data in /var/lib/postgresql/18/docker). PostgreSQL 15–17: mount /var/lib/postgresql/data |
| Config | the official PostgreSQL image's POSTGRES_* variables, plus the CITUS_* variables below |
| Runs as | UID/GID 10001. With a read-only root filesystem, /var/run/postgresql and /tmp must be writable |
| Default auth | password required (POSTGRES_PASSWORD); trust only for connections from inside the container |
| Shutdown | SIGINT (fast shutdown); docker stop takes about a second |
AI agents and coding assistants: read AGENTS.md for deployment rules, and llms.txt for an index of all docs.
A single node is a complete Citus database. The coordinator stores the shards itself until you add workers:
docker run -d --name citus -p 5432:5432 \
-e POSTGRES_PASSWORD=change-me \
-v citus-data:/var/lib/postgresql \
upstreamyard/citus:14.3
docker exec -it citus psql -U postgres
CREATE TABLE events (tenant_id int, id bigserial, payload jsonb, PRIMARY KEY (tenant_id, id));
SELECT create_distributed_table('events', 'tenant_id');
SELECT citus_version();
The citus extension is created in POSTGRES_DB (default postgres) when the data directory is first created.
docker-compose.yml starts a coordinator and two workers. The workers add themselves to the coordinator:
curl -fsSLO https://raw.githubusercontent.com/upstreamyard/citus/main/docker-compose.yml
export POSTGRES_PASSWORD=change-me # every docker compose command needs it
docker compose up -d --wait
docker compose exec coordinator psql -U postgres -c 'SELECT * FROM citus_get_active_worker_nodes()'
Connect your application to the coordinator (localhost:5432). To add a worker, copy the worker-2 service with a new name, hostname and volume, start it, and spread the shards:
SELECT citus_rebalance_start();
SELECT citus_rebalance_wait(); -- or watch SELECT * FROM citus_rebalance_status();
Tested: a rebalance onto a third worker moved 10 shards in 16 seconds while a client kept inserting; all 400 concurrent inserts succeeded and no rows were lost.
Give every worker a fixed hostname: Citus stores node names in its metadata. With docker compose up --scale, a worker's hostname is its container ID, which changes when the container is recreated.
All variables of the official PostgreSQL image work (POSTGRES_PASSWORD, POSTGRES_USER, POSTGRES_DB, POSTGRES_INITDB_ARGS, *_FILE, …). Use the same POSTGRES_USER, POSTGRES_PASSWORD and POSTGRES_DB on every node of a cluster.
| Variable | Default | Description |
|---|---|---|
POSTGRES_PASSWORD | – (required) | Password of POSTGRES_USER. The nodes also use it to log in to each other |
POSTGRES_PASSWORD_FILE | – | Read the password from a file, e.g. a mounted Secret |
CITUS_COORDINATOR_HOST | – | Set on workers: the coordinator's host name. Once PostgreSQL is up, the worker adds itself with citus_add_node(), retrying until the coordinator answers. Safe on every restart |
CITUS_COORDINATOR_PORT | 5432 | Coordinator port. Values that aren't a plain number (like Kubernetes' tcp://… service variables) are ignored |
CITUS_NODE_HOST | hostname -f | Name the coordinator and other workers use to reach this worker. Must stay the same across restarts |
CITUS_NODE_PORT | PGPORT or 5432 | Port other nodes use to reach this worker |
CITUS_PGPASS_FILE | – | Extra lines for the password file (host:port:database:user:password), for other roles that run distributed queries. See below |
PGPASSFILE | /var/run/postgresql/.pgpass | If you set it, the container uses your file and doesn't write one |
When a worker registers and the coordinator is still in the metadata as localhost (because it started single-node), the worker replaces that entry with CITUS_COORDINATOR_HOST, so the other nodes can reach the coordinator.
Citus connects from one node to another as the role that runs the query. The container writes a password file with the POSTGRES_USER password, so the admin user works across nodes, over TLS (Citus turns on TLS with a self-signed certificate when the extension is created).
An application role (CREATE ROLE app LOGIN PASSWORD '…', run on the coordinator, is copied to the workers) also needs its password for these connections. Otherwise distributed queries fail with fe_sendauth: no password supplied. Mount a file on every node and point CITUS_PGPASS_FILE at it:
printf '*:*:*:app:app-password\n' > pgpass
docker run … -v "$PWD/pgpass:/run/secrets/pgpass:ro" -e CITUS_PGPASS_FILE=/run/secrets/pgpass upstreamyard/citus:14.3
Tested: Citus's pg_dist_authinfo table is not copied to the workers, so with queries from workers it would have to be filled on every node. The file works on all nodes at once.
New data directories get shared_preload_libraries = 'citus' and wal_level = logical. Other settings: pass -c options, or use ALTER SYSTEM and restart.
docker run … upstreamyard/citus:14.3 postgres -c max_connections=300 -c shared_buffers=1GB
citus must stay first in shared_preload_libraries.
| Extension | Use |
|---|---|
citus | created automatically in POSTGRES_DB |
hll, topn | CREATE EXTENSION hll; on the coordinator; Citus creates it on the workers |
vector (pgvector) | CREATE EXTENSION vector; on the coordinator; vectors in distributed tables |
pg_cron | needs preloading: postgres -c shared_preload_libraries=citus,pg_cron -c cron.database_name=postgres, then CREATE EXTENSION pg_cron; |
Move its shards away first, then remove it. Tested on Kubernetes (16 shards, 50,000 rows: 12 seconds):
SELECT citus_drain_node('worker-3', 5432);
CALL citus_cleanup_orphaned_resources();
SELECT citus_remove_node('worker-3', 5432);
Then stop the worker and delete its volume. A worker started later on an old volume still has shard tables from before, and shard moves to it failed in our test with orphaned shard … could not be cleaned up.
examples/kubernetes/citus.yaml runs a coordinator and two workers as StatefulSets. Workers add themselves under their stable pod DNS names (citus-worker-0.citus-worker.<namespace>.svc.cluster.local):
kubectl create secret generic citus-auth --from-literal=password='change-me'
kubectl apply -f https://raw.githubusercontent.com/upstreamyard/citus/main/examples/kubernetes/citus.yaml
kubectl exec -it citus-coordinator-0 -- psql -U postgres -c 'SELECT * FROM citus_get_active_worker_nodes()'
Scale out with kubectl scale statefulset citus-worker --replicas=3, then SELECT citus_rebalance_start();. To scale in, follow Removing a worker for the highest-numbered pod, scale down, and delete its PVC (data-citus-worker-2).
We tested the manifest in kind (Kubernetes 1.34): scale out to three workers and a rebalance (16 s), drain and scale in, pod deletion (the worker came back with the same node ID), and adding a worker on a fresh PVC.
Rules for your own manifests:
enableServiceLinks: false. Otherwise a Service named citus-coordinator makes Kubernetes set CITUS_COORDINATOR_PORT=tcp://… in every pod. The image ignores such values, but other tools may not.runAsNonRoot, readOnlyRootFilesystem and dropping all capabilities work, with emptyDir volumes at /var/run/postgresql and /tmp.exec: [healthcheck].High availability: every Citus node is a single PostgreSQL server. This image doesn't add streaming replicas or automatic failover per node. If a worker's volume is lost, the shards on it are lost.
Not sure about your values or manifests? Tell us about your setup and we'll share what we found while testing.
citusdata/citus image14.3.0, 14.3.0-pg17, …) select the same Citus and PostgreSQL versions.10001:
docker run --rm --user 0 --entrypoint chown -v citus-data:/var/lib/postgresql upstreamyard/citus:14.3 -R 10001:10001 /var/lib/postgresql
ALTER EXTENSION citus UPDATE; on every node. Tested on a single node: a 14.2.0 data directory from the official image went from 14.2-1 to 14.3-1, all rows kept.wal_level: existing data directories keep replica. For online shard moves, run ALTER SYSTEM SET wal_level = logical; and restart.PGPASSWORD and POSTGRES_HOST_AUTH_METHOD=trust. The password file handles it.CITUS_COORDINATOR_HOST on the workers.How do I run Citus in Docker? docker run -e POSTGRES_PASSWORD=change-me -p 5432:5432 upstreamyard/citus:14.3; see the quick start.
How do I set up a multi-node Citus cluster? Use Docker Compose or the Kubernetes manifest: set CITUS_COORDINATOR_HOST on each worker.
Is Citus a fork of PostgreSQL? No, it's a PostgreSQL extension. This image is the official PostgreSQL image with Citus added, so PostgreSQL tools and drivers work unchanged.
Which version should I use? Citus 14.3 on PostgreSQL 18 for new clusters. Existing clusters: stay on your PostgreSQL major version and take the newest Citus line built for it (13.5 on PostgreSQL 16 or 17, 12.1 on PostgreSQL 15).
Is there an arm64 Citus image? Yes, every tag is built for amd64 and arm64.
Why do distributed queries fail with fe_sendauth: no password supplied? Citus connects to the workers as the querying role, and that role's password isn't known on the node. See application roles.
Why does citus_rebalance_start() or citus_drain_node() fail with logical decoding requires "wal_level" >= "logical"? The data directory was created with another image. Run ALTER SYSTEM SET wal_level = logical; and restart.
Why does a rebalance hang with not enough empty space on node if the shard is moved? Citus keeps 10% of the disk free and retries the move. Free up space, or lower citus.desired_percent_disk_available_after_move.
Does it send usage statistics? No. Citus's anonymous statistics collection is off in this build (citus.enable_statistics_collection = off).
Images are signed keylessly with cosign and include an SBOM and SLSA provenance:
cosign verify upstreamyard/citus:14.3 \
--certificate-identity-regexp '^https://github.com/upstreamyard/citus/' \
--certificate-oidc-issuer https://token.actions.githubusercontent.com
docker buildx imagetools inspect upstreamyard/citus:14.3 --format '{{ json .SBOM }}'
.github/workflows/build.yml finds the newest release of each maintained Citus line and reads the PostgreSQL versions it supports from its configure.ac. For each pair, it builds the Dockerfile for amd64 and arm64.
postgres:<major>-trixie image, pinned by digest and recorded in the org.opencontainers.image.base.digest label. A new base digest triggers a rebuild.postgres user is UID/GID 10001 instead of 999;shared_preload_libraries = 'citus' and wal_level = logical for new data directories;scripts/smoke-test.sh starts a coordinator and self-registering workers (amd64) and checks:
CITUS_PGPASS_FILE;| Component | Licence | Licence text in the image | Source code |
|---|---|---|---|
| Citus | AGPL-3.0 | /licenses/citus/ | citusdata/citus at tag v<version> |
| TopN | AGPL-3.0 | /licenses/topn/ | citusdata/postgresql-topn |
| PostgreSQL, hll, pgvector, pg_cron, Debian packages | PostgreSQL, Apache-2.0 and others | /usr/share/doc/*/copyright | PostgreSQL apt repository and Debian source archives |
| Our packaging (Dockerfile, scripts) | Apache-2.0 | – | this repository |
Email [email protected]. The maintainers of this image read and answer it.
You can write to us about:
Not sure if your question fits? Send it anyway. Two sentences about what you run and where you're stuck are enough.
Issues with the image: open an issue here. Questions about using Citus: Citus documentation and Citus on GitHub.
docker pull upstreamyard/citus:latest