Configuration Spec v2 Reference
Spec version 2 describes a set of services. It is the shape the API returns for every configuration version, the shape in configuration documents (admrl get configuration -o yaml), and the shape you send to POST /v1/configurations and PUT /v1/configurations/{id}/spec.
Rules for every request:
versionmust be2. A body with noversionis read as the deprecated version 1 shape.- Unknown keys are rejected, so a typo cannot be saved silently.
- Responses always contain every collection (
{}or[]) rather than leaving the key out.
Full example
spec:
version: 2
desiredState: RUNNING
network:
mode: bridge
services:
web:
image: ghcr.io/example/web:1.4
command: ["./web", "--port", "8080"]
environment:
DB_HOST: db
ports:
- { port: 8080, protocol: tcp, hostPort: 80 }
mounts:
- { type: tmpfs, source: tmpfs, destination: /tmp }
volumes:
- { name: data, destination: /var/lib/web, readOnly: true }
registryCredentialId: 5c0f3b4e-0000-0000-0000-000000000000
resources:
memory: 512Mi
dependsOn:
db: { condition: service_healthy }
restart: always
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/healthz"]
interval: 30s
timeout: 5s
retries: 3
startPeriod: 20s
secrets: ["/admrl/secrets/web.env"]
tty: false
readOnlyRoot: false
ephemeralRoot: false
db:
image: docker.io/library/postgres:16
environment:
POSTGRES_PASSWORD_FILE: /admrl/secrets/pg
volumes:
- { name: data, destination: /var/lib/postgresql/data }
secrets: ["/admrl/secrets/pg"]
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
restart: always
volumes:
data:
backup: { enabled: true }
edgewire:
services:
- { name: web, protocol: tcp, port: 8080, service: web }
options:
hostResolv: true
hostHosts: false
isolateDevices: false
exposeDBus: false
disableHostBluetooth: false
imageCleaning:
enabled: true
retentionCount: 2
signaturePolicy:
required: false
Top level
| Key | Type | Default | Meaning |
|---|---|---|---|
version | integer | Always 2. | |
desiredState | RUNNING or STOPPED | RUNNING | Whether the whole set should run. There is no per-service desired state. |
network | object | bridge | Set network. See network. |
services | map, name to service | required | The services, keyed by name. At least one. |
volumes | map, name to volume | {} | Named volumes shared by the set. See volumes. |
configs | map, name to config | {} | Managed text files that services mount read-only. See configs. |
edgewire | object | none | EdgeWire service names. See edgewire. |
options | object | all off | Set-level runtime options. See options. |
signaturePolicy | object | inherit | Image signature trust for every image in the set. Inherits organisation and fleet requirements when omitted. |
network
| Key | Values | Default | Meaning |
|---|---|---|---|
mode | bridge, host | bridge | bridge: each service has its own network namespace and address on the device bridge, and service names resolve to peers. host: every service shares the host network namespace, and every service name resolves to 127.0.0.1. |
In host mode all services share one port space, so a container port can appear in only one service.
services.<name>
The key is the service name: ^[a-z][a-z0-9_-]{0,31}$, not ssh, exec or debug.
| Key | Type | Default | Meaning |
|---|---|---|---|
image | string | required | OCI image reference to pull and run. Surrounding whitespace is trimmed. |
command | list of strings | image default | Replaces the image ENTRYPOINT and CMD. See the launch contract. Mutually exclusive with args. |
args | list of strings | image default | Replaces the image CMD and keeps the image ENTRYPOINT, as compose command does. Mutually exclusive with command. |
user | string | root, or the image user | User to run as: uid[:gid] or name[:group], with names resolved in the image. |
groupAdd | list of strings | none | Supplementary groups, as names or numeric IDs. |
workingDir | absolute path | /, or the image working directory | Working directory of the process. The device creates it when missing. |
processDefaults | root, image | root | root runs as root in /, as services always have. image honours the image's USER, WORKDIR and STOPSIGNAL. Services imported from compose use image. user and workingDir override either. |
environment | map of strings | {} | Environment variables for the service. |
ports | list | [] | Published ports. See ports. |
mounts | list | [] | Extra mounts: tmpfs, or sources under /dev. See System Mounts. |
volumes | list | [] | Attachments of named volumes. See volumes in a service. |
configs | list | [] | Config files mounted read-only. See configs. |
registryCredentialId | string | none | A saved registry credential used to pull this service's image. Each service has its own. |
resources | object | none | memory, cpus, pids and memoryReservation limits. See resources. |
dependsOn | map, service to condition | none | Services this one starts after. See dependsOn. |
restart | always, on-failure, no | always | Restart policy. |
restartMaxAttempts | integer | 0 (no limit) | Consecutive failed restarts before the service stays down. Only with restart: on-failure. |
healthcheck | object | none | Probe run on the device. See healthcheck. |
secrets | list of paths | none | Secret files this service sees. See secrets. |
hostname | string | the container ID | Host name inside the service. An RFC 1123 label. |
aliases | list of strings | none | Extra names under which the other services reach this one. |
extraHosts | list | none | Extra hosts-file entries: {host, ip}. ip can be host-gateway for the set's gateway address. |
dns | object | the set's resolver | servers (IP addresses), search (domains) and options for this service's resolver. Overrides options.hostResolv for the service. |
labels | map of strings | none | Labels on the container. At most 64, keys up to 128 bytes, values up to 1024 bytes. Keys under prefixes reserved by container runtimes are rejected. |
privileged | boolean | false | Run with every capability and device. Needs fleet host access. |
capAdd, capDrop | list of strings | none | Capabilities added to or removed from the default set, as CAP_* names or ALL. A name cannot be in both. Adding a powerful capability needs fleet host access. |
devices | list | none | Host device nodes: {source, target, permissions}. source is a path under /dev, target defaults to source, permissions is a subset of rwm (default rwm). Needs fleet host access. |
ulimits | map, name to {soft, hard} | the device defaults | Resource limits by name, such as nofile and memlock. -1 is unlimited. |
sysctls | map of strings | none | Namespaced kernel parameters. |
shmSize | quantity | device default | Size of /dev/shm, for example 512Mi. |
stopSignal | signal name | SIGTERM | Signal that asks the service to stop. |
stopGracePeriod | duration | 10s | Time to wait before the service is killed. Whole seconds, at most 3600. |
init | boolean | false | Run a small init process in front of the command that reaps stray child processes. |
tty | boolean | false | Give this service the device screen and keyboard. At most one service per set. |
readOnlyRoot | boolean | false | Mount the service's root filesystem read-only. |
ephemeralRoot | boolean | false | Use a temporary writable root layer that is discarded when the service stops. |
Many of these fields need a device agent that supports them. Agent features lists the feature each field needs.
ports
ports:
- { port: 8080, protocol: tcp, hostPort: 80 }
| Key | Type | Default | Meaning |
|---|---|---|---|
port | integer 1 to 65535 | required | Container port. |
protocol | tcp, udp | tcp | Transport protocol. |
hostPort | integer 1 to 65535 | same as port | Published port on the device. |
Each (protocol, hostPort) is unique across the set. In host network mode each (protocol, port) is unique across the set too. The same container port can appear in several services on the bridge, because each service has its own namespace.
volumes in a service
volumes:
- { name: data, destination: /var/lib/web, readOnly: true }
| Key | Type | Meaning |
|---|---|---|
name | string | Name of a volume declared in the set's volumes. Required; an undefined name is an error. |
destination | absolute path | Mount path inside the service. |
readOnly | boolean | Mount read-only in this service. Must be true when the volume's options contain ro. |
A service attaches a given volume once.
resources
| Key | Meaning |
|---|---|
memory | Bytes, or a quantity with a K, M, G, T (decimal) or Ki, Mi, Gi, Ti (binary) suffix, for example 512Mi. Compose forms such as 512mb are accepted. At least 4Mi, at most 1Ti, and below the set's memory ceiling, which is sized from the host. |
cpus | CPU limit as a decimal number of CPUs, for example "1.5". At most three decimals. |
pids | Maximum number of processes and threads. |
memoryReservation | Memory the service is protected from reclaim below. A quantity, not above memory. |
configs
Config files are small text files that the configuration owns. Declare them once at set level, and mount them into services:
configs:
mosquitto.conf:
content: |
listener 1883
allow_anonymous true
services:
broker:
image: docker.io/library/eclipse-mosquitto:2
configs:
- source: mosquitto.conf
target: /mosquitto/config/mosquitto.conf
| Key | Type | Meaning |
|---|---|---|
configs.<name>.content | string | The file's text. May be empty. UTF-8 only. |
services.<name>.configs[].source | string | A name in the set's configs. |
services.<name>.configs[].target | absolute path | File path in the service. Not /, and not under /admrl, /proc, /sys or /dev. Unique in the service, and different from its mount and volume paths. |
services.<name>.configs[].mode | integer | Permissions as a number, at most 0777 (511). Default 0444 (292). Compose files write it as a quoted octal string, "0444". |
services.<name>.configs[].uid, gid | integer | File owner and group. Default: the service's user and that user's primary group. |
A config name matches ^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$. A file is at most 256 KiB, and all files together at most 1 MiB. The device writes each file and mounts it read-only. A change to the content recreates only the services that mount it. A config that no service mounts is allowed.
Configs are not secrets. They are stored in the configuration version, visible to anyone who can view the configuration, and exported as written. Put credentials in secret files. See Docker Compose for how compose file binds become configs.
dependsOn
dependsOn:
db: { condition: service_healthy }
migrate: { condition: service_completed_successfully }
| Key | Values | Default | Meaning |
|---|---|---|---|
condition | service_started, service_healthy, service_completed_successfully | service_started | service_started waits for the target to run. service_healthy waits for the target to be healthy and requires a healthcheck on the target. service_completed_successfully waits for the target to exit with code 0 and requires the target to use restart: on-failure or restart: no. |
Targets must exist and the graph must have no cycles.
healthcheck
| Key | Type | Default | Meaning |
|---|---|---|---|
test | list of strings | required | ["CMD", "program", "arg", ...] runs the program directly. ["CMD-SHELL", "command"] runs the single command string with /bin/sh -c. |
interval | duration | 30s | Time between probes. Whole seconds, at least 5s. |
timeout | duration | 5s | Probe timeout. Whole seconds, at most interval. |
retries | integer | 3 | Consecutive failures before the service is unhealthy. |
startPeriod | duration | none | Failures inside this period do not count. Whole seconds. |
onUnhealthy | restart, none | restart | What the device does when the service becomes unhealthy. restart restarts it through the restart policy. none only reports it. See Health checks. |
secrets
| Value | Meaning |
|---|---|
omitted or [] | The service sees no secret files. |
["/admrl/secrets/a.env", "/admrl/secrets/b.key"] | The service sees only these files. Paths are absolute and must not repeat. |
["*"] | Every secret file in scope. "*" must be the only entry. |
A listed path with no matching file in the configuration's or device's secret files is reported as a warning, not an error.
volumes
volumes:
data:
backup: { enabled: true }
| Key | Type | Meaning |
|---|---|---|
backup.enabled | boolean | Take backup snapshots of this volume. |
options | list of strings | Linux mount options such as rbind and rw. ro makes every attachment read-only. |
source | string | Legacy host source directory carried over from version 1. Devices key volumes by name and do not need it. |
Volume names must not be empty. Attach a volume to a service with services.<name>.volumes. A volume no service attaches is allowed in a set.
edgewire
edgewire:
services:
- { name: web, protocol: tcp, port: 8080, service: web }
| Key | Meaning |
|---|---|
name | EdgeWire service name used in forward grants. |
protocol | tcp or udp. |
port | Port the service listens on, on its own loopback. |
service | The service of the set that listens on port. Required when the set has more than one service; it must name an existing service. |
options
Set-level options apply to every service.
| Key | Default | Meaning |
|---|---|---|
hostResolv | false | Use the host DNS resolver configuration. |
hostHosts | false | Append the host's hosts file to the set's hosts file. |
isolateDevices | false | Replace /dev with a restricted set instead of passing host devices. See Hardware Access. |
exposeDBus | false | Mount the host system D-Bus socket into the services. |
disableHostBluetooth | false | Hand the Bluetooth adapter to the set and stop the host Bluetooth service while it runs. |
imageCleaning.enabled | Allow unused images to be removed. false turns image removal off. | |
imageCleaning.retentionCount | Recent image versions to keep. At least one previous version is always kept for rollback. | |
imageCleaning.intervalHours | 24 | Hours between scheduled cleanups. |
imageCleaning.maxAgeDays, pruneOnUpdate and pruneDangling are accepted but have no effect: current devices clean unneeded images regardless. The options newPrivileges, privileged, parentCgroupDevices, cgroup, maskedPaths, readonlyPaths, capabilities and devices are also accepted for compatibility and not applied by current devices. Use the per-service privileged, capAdd, capDrop and devices instead.
signaturePolicy
One policy covers every image in the set. It can add to an organisation or fleet requirement but cannot relax it.
| Key | Meaning |
|---|---|
required | Require a trusted image signature before running. |
cosignKeys | Trusted Cosign public keys, each with an optional name and a PEM publicKey. A signature from any key is accepted. |
notation | Trusted Notation certificates (caCerts) and the signer identities allowed to sign (trustedIdentities), with an optional name. |
Validation summary
The API rejects a spec when:
versionis not2,desiredStateis notRUNNINGorSTOPPED, ornetwork.modeis notbridgeorhost.- There is no service, a service name is invalid, reserved or duplicated, or a service has no
image. - A port is 0, has a protocol other than
tcporudp, or a published host port repeats. - In
hostmode a container port repeats across services. - A service attaches an undefined volume, attaches a volume twice, uses a relative destination, or is not read-only on a volume whose
optionscontainro. secretsmixes"*"with paths, repeats a path, or has a relative path.resources.memorydoes not parse, or is outside 4Mi to 1Ti.- A health check has a bad
testform, an interval under 5 seconds, a timeout above the interval, a duration that is not whole seconds, or anonUnhealthyother thanrestartornone. dependsOnnames an unknown service, repeats a service, forms a cycle, usesservice_healthyon a service with nohealthcheck, or usesservice_completed_successfullyon a service that restartsalways.- More than one service sets
tty. - An
edgewire.services[].serviceis missing in a multi-service set or names an unknown service. - A service sets both
commandandargs, auserthat is notuid[:gid]orname[:group], a relativeworkingDir, aprocessDefaultsother thanrootorimage, ahostnamethat is not an RFC 1123 label, orrestartMaxAttemptswithoutrestart: on-failure. - A capability is not a
CAP_*name orALL, or is in bothcapAddandcapDrop. A devicesourceis not under/dev. resources.cpus,memoryReservation,shmSizeorstopGracePerioddoes not parse, orstopGracePeriodis over 3600 seconds.- A service mounts a config that the set does not define, a config target is relative or under
/admrl,/proc,/sysor/dev, a config is not UTF-8, or the config files exceed their size limits.
Saving a spec can also be refused for reasons that do not depend on the spec alone: 409 host_access_not_allowed when a fleet does not allow the host access it uses (Workload host access), and 409 unsupported_by_agent when devices in a fleet that follows the configuration run an agent that lacks a feature it needs (Agent features).
When a configuration is rendered for a device, a service memory limit that is not below the set's memory ceiling for that device is also rejected.