Docker Deployment
Run Flo with Docker and Docker Compose.
Docker Image
docker pull ghcr.io/floruntime/flo:latest
Quick Start
docker run -d \
--name flo \
--security-opt seccomp=unconfined \
-p 9000:9000 \
-p 9001:9001 \
-p 9002:9002 \
-v flo-data:/data/flo \
ghcr.io/floruntime/flo:latest
:::note
--security-opt seccomp=unconfined is required on Linux hosts. Flo's event
loop uses io_uring, which Docker's default seccomp profile blocks — without it
the server starts, logs topology manifest created, and then exits. See
io_uring and seccomp for the details and for a
narrower profile.
:::
| Port | Purpose |
|---|---|
| 9000 | Binary wire protocol (client traffic) |
| 9001 | Prometheus metrics — only when [metrics] enabled = true |
| 9002 | Dashboard REST API — only when [dashboard] enabled = true |
Flo does not listen on any other port in a single-node deployment. In
particular the Raft port (listen_port + 500, so 9500) is bound only when the
node is actually clustered — see Clustering.
io_uring and seccomp
On Linux, Flo's event loop is built on io_uring. Docker's default seccomp
profile does not allow the io_uring_setup, io_uring_enter and
io_uring_register syscalls, so under that profile Flo cannot start:
INF topology manifest created: shards=1 path=/data
ERR io_uring is unavailable (PermissionDenied). ...
Error starting runtime: error.PermissionDenied
The simplest fix is to run unconfined:
--security-opt seccomp=unconfined
If you would rather not drop the whole profile, copy Docker's default profile and add the three syscalls to its allowlist:
{
"names": ["io_uring_setup", "io_uring_enter", "io_uring_register"],
"action": "SCMP_ACT_ALLOW"
}
Then run with --security-opt seccomp=/path/to/flo-seccomp.json.
:::note io_uring requires Linux 5.1 or newer. On older kernels Flo cannot start at all, and no seccomp profile will help. Kubernetes, Podman and containerd apply their own seccomp defaults — the same allowance is needed there. :::
Docker Compose — Single Node
version: "3.8"
services:
flo:
image: ghcr.io/floruntime/flo:latest
security_opt:
- seccomp:unconfined
ports:
- "9000:9000"
- "9001:9001"
- "9002:9002"
volumes:
- flo-data:/data/flo
restart: unless-stopped
volumes:
flo-data:
Docker Compose — 3-Node Cluster
The first member starts with --cluster; the others join it at its peer port
(listen_port + 500). Every member proves the same secret, here from the
environment. The image's own config (/etc/flo/flo.toml) stays on the command
line: it is what puts the data under the mounted volume and binds the metrics
and dashboard ports to every interface. A cluster replicates one shard, and
the image's automatic shard count resolves to one.
version: "3.8"
x-flo: &flo
image: ghcr.io/floruntime/flo:latest
security_opt:
- seccomp:unconfined
environment:
- FLO_CLUSTER_SECRET=${FLO_CLUSTER_SECRET} # from `flo server secret`, the same on every node
restart: unless-stopped
services:
flo-1:
<<: *flo
hostname: flo-1
command: ["server", "start", "-c", "/etc/flo/flo.toml", "--cluster"]
ports:
- "9000:9000"
- "9001:9001"
- "9002:9002"
volumes:
- flo-1-data:/data/flo
flo-2:
<<: *flo
hostname: flo-2
command: ["server", "start", "-c", "/etc/flo/flo.toml", "--join", "flo-1:9500"]
ports:
- "9010:9000"
- "9011:9001"
- "9012:9002"
volumes:
- flo-2-data:/data/flo
flo-3:
<<: *flo
hostname: flo-3
command: ["server", "start", "-c", "/etc/flo/flo.toml", "--join", "flo-1:9500"]
ports:
- "9020:9000"
- "9021:9001"
- "9022:9002"
volumes:
- flo-3-data:/data/flo
volumes:
flo-1-data:
flo-2-data:
flo-3-data:
Members find each other on the Compose network by service name; the peer port
is never published. A joiner started before flo-1 resolves exits, and
restart: unless-stopped brings it back. A restarted member keeps the same
command line: its membership comes from its volume. flo cluster status
against any published port shows the role of that node.
Environment Variables
The image reads two variables; everything else comes from flo.toml (mounted
at /etc/flo/flo.toml) or from flags on the command line:
| Variable | Default | Description |
|---|---|---|
FLO_DATA_DIR | /data/flo | The directory the entrypoint hands to the flo user before starting it. flo itself doesn't read it: keep the server's data_dir (in flo.toml or --data-dir) the same path |
FLO_CLUSTER_SECRET | — | The shared secret every member proves at the peer port; only one made by flo server secret is accepted |
Health Check
The image's own HEALTHCHECK is liveness: the dashboard's or the metrics
port's /health, else the client port open. A container health check should
stay that way. Don't point one at /ready: Swarm and auto-healers restart an
unhealthy container, and a node replaying its log, or one that can't be ready
until an operator acts, would be restarted mid-replay or forever.
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:9002/health || exit 1"]
interval: 10s
timeout: 5s
retries: 3
Use /ready where traffic or start order depends on the node serving: a load
balancer's target check, a Kubernetes readiness probe, or a Compose service that
others wait on with depends_on: { flo: { condition: service_healthy } }, as
the Compose example
does: curl -sf http://localhost:9002/ready with start_period: 120s, so a long
replay can finish. See REST API for its answers.
A probe from outside the container must reach the port it checks, and the
dashboard and metrics ports bind 127.0.0.1 by default:
[dashboard]
enabled = true
bind = "0.0.0.0"
:::note
A probe that can't reach a loopback listener looks like a service that never
becomes ready, which reads like a broken health check rather than a bind
address. Bind to 0.0.0.0 only where the port is not publicly routable: the
dashboard authenticates no one yet.
:::
Volumes and Data Persistence
The image's config puts data under /data/flo; mount a volume there so it
survives container restarts:
docker volume create flo-data
docker run -v flo-data:/data/flo ghcr.io/floruntime/flo:latest
:::note
Keep the data directory on a filesystem that enforces file locks. A
server holds an flock on flo.lock in its data directory, and that lock is
what refuses a second server on the same directory. Two servers on one data
directory lose data. Some filesystems ignore flock between processes, and on
them nothing stops the second server:
- Docker Desktop bind mounts from a Mac (
docker run -v ./data:/data/flo …). Use a named volume, as above. - NFS mounted without locking (
nolock, or no lock daemon). - NFS with
local_lock=flock: the lock holds on one host only, so a server on another host can still start.
flo warns at start when another process can take its lock. That covers the first two cases. It can't see the third. :::
The data directory structure:
/data/flo/
├── flo.lock # held by the running server
├── FORMAT # the data directory's format
├── SYSTEM # its shard count
└── 00000/ # one directory per shard
├── segs/ # the durable log
└── HARDSTATE # the node's id and its Raft term and vote
After an upgrade that changes the format
A server refuses a volume written in another format and exits with code 78. Docker's restart policies can't stop on one exit code, so restart: unless-stopped restarts it in a loop; docker logs shows why. There is no migration: stop the service, empty the volume, and start it again.
docker compose stop flo
docker compose run --rm flo server wipe -c /etc/flo/flo.toml --yes
docker compose start flo
--keep-as <name> moves the old contents into /data/flo/.flo-kept-<name> instead of deleting them.
Building the Image
cd flo
docker build -t flo:custom .