Skip to main content

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:

  • version must be 2. A body with no version is 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​

KeyTypeDefaultMeaning
versionintegerAlways 2.
desiredStateRUNNING or STOPPEDRUNNINGWhether the whole set should run. There is no per-service desired state.
networkobjectbridgeSet network. See network.
servicesmap, name to servicerequiredThe services, keyed by name. At least one.
volumesmap, name to volume{}Named volumes shared by the set. See volumes.
configsmap, name to config{}Managed text files that services mount read-only. See configs.
edgewireobjectnoneEdgeWire service names. See edgewire.
optionsobjectall offSet-level runtime options. See options.
signaturePolicyobjectinheritImage signature trust for every image in the set. Inherits organisation and fleet requirements when omitted.

network​

KeyValuesDefaultMeaning
modebridge, hostbridgebridge: 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.

KeyTypeDefaultMeaning
imagestringrequiredOCI image reference to pull and run. Surrounding whitespace is trimmed.
commandlist of stringsimage defaultReplaces the image ENTRYPOINT and CMD. See the launch contract. Mutually exclusive with args.
argslist of stringsimage defaultReplaces the image CMD and keeps the image ENTRYPOINT, as compose command does. Mutually exclusive with command.
userstringroot, or the image userUser to run as: uid[:gid] or name[:group], with names resolved in the image.
groupAddlist of stringsnoneSupplementary groups, as names or numeric IDs.
workingDirabsolute path/, or the image working directoryWorking directory of the process. The device creates it when missing.
processDefaultsroot, imagerootroot 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.
environmentmap of strings{}Environment variables for the service.
portslist[]Published ports. See ports.
mountslist[]Extra mounts: tmpfs, or sources under /dev. See System Mounts.
volumeslist[]Attachments of named volumes. See volumes in a service.
configslist[]Config files mounted read-only. See configs.
registryCredentialIdstringnoneA saved registry credential used to pull this service's image. Each service has its own.
resourcesobjectnonememory, cpus, pids and memoryReservation limits. See resources.
dependsOnmap, service to conditionnoneServices this one starts after. See dependsOn.
restartalways, on-failure, noalwaysRestart policy.
restartMaxAttemptsinteger0 (no limit)Consecutive failed restarts before the service stays down. Only with restart: on-failure.
healthcheckobjectnoneProbe run on the device. See healthcheck.
secretslist of pathsnoneSecret files this service sees. See secrets.
hostnamestringthe container IDHost name inside the service. An RFC 1123 label.
aliaseslist of stringsnoneExtra names under which the other services reach this one.
extraHostslistnoneExtra hosts-file entries: {host, ip}. ip can be host-gateway for the set's gateway address.
dnsobjectthe set's resolverservers (IP addresses), search (domains) and options for this service's resolver. Overrides options.hostResolv for the service.
labelsmap of stringsnoneLabels 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.
privilegedbooleanfalseRun with every capability and device. Needs fleet host access.
capAdd, capDroplist of stringsnoneCapabilities 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.
deviceslistnoneHost 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.
ulimitsmap, name to {soft, hard}the device defaultsResource limits by name, such as nofile and memlock. -1 is unlimited.
sysctlsmap of stringsnoneNamespaced kernel parameters.
shmSizequantitydevice defaultSize of /dev/shm, for example 512Mi.
stopSignalsignal nameSIGTERMSignal that asks the service to stop.
stopGracePeriodduration10sTime to wait before the service is killed. Whole seconds, at most 3600.
initbooleanfalseRun a small init process in front of the command that reaps stray child processes.
ttybooleanfalseGive this service the device screen and keyboard. At most one service per set.
readOnlyRootbooleanfalseMount the service's root filesystem read-only.
ephemeralRootbooleanfalseUse 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 }
KeyTypeDefaultMeaning
portinteger 1 to 65535requiredContainer port.
protocoltcp, udptcpTransport protocol.
hostPortinteger 1 to 65535same as portPublished 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 }
KeyTypeMeaning
namestringName of a volume declared in the set's volumes. Required; an undefined name is an error.
destinationabsolute pathMount path inside the service.
readOnlybooleanMount read-only in this service. Must be true when the volume's options contain ro.

A service attaches a given volume once.

resources​

KeyMeaning
memoryBytes, 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.
cpusCPU limit as a decimal number of CPUs, for example "1.5". At most three decimals.
pidsMaximum number of processes and threads.
memoryReservationMemory 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
KeyTypeMeaning
configs.<name>.contentstringThe file's text. May be empty. UTF-8 only.
services.<name>.configs[].sourcestringA name in the set's configs.
services.<name>.configs[].targetabsolute pathFile 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[].modeintegerPermissions as a number, at most 0777 (511). Default 0444 (292). Compose files write it as a quoted octal string, "0444".
services.<name>.configs[].uid, gidintegerFile 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 }
KeyValuesDefaultMeaning
conditionservice_started, service_healthy, service_completed_successfullyservice_startedservice_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​

KeyTypeDefaultMeaning
testlist of stringsrequired["CMD", "program", "arg", ...] runs the program directly. ["CMD-SHELL", "command"] runs the single command string with /bin/sh -c.
intervalduration30sTime between probes. Whole seconds, at least 5s.
timeoutduration5sProbe timeout. Whole seconds, at most interval.
retriesinteger3Consecutive failures before the service is unhealthy.
startPerioddurationnoneFailures inside this period do not count. Whole seconds.
onUnhealthyrestart, nonerestartWhat the device does when the service becomes unhealthy. restart restarts it through the restart policy. none only reports it. See Health checks.

secrets​

ValueMeaning
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 }
KeyTypeMeaning
backup.enabledbooleanTake backup snapshots of this volume.
optionslist of stringsLinux mount options such as rbind and rw. ro makes every attachment read-only.
sourcestringLegacy 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 }
KeyMeaning
nameEdgeWire service name used in forward grants.
protocoltcp or udp.
portPort the service listens on, on its own loopback.
serviceThe 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.

KeyDefaultMeaning
hostResolvfalseUse the host DNS resolver configuration.
hostHostsfalseAppend the host's hosts file to the set's hosts file.
isolateDevicesfalseReplace /dev with a restricted set instead of passing host devices. See Hardware Access.
exposeDBusfalseMount the host system D-Bus socket into the services.
disableHostBluetoothfalseHand the Bluetooth adapter to the set and stop the host Bluetooth service while it runs.
imageCleaning.enabledAllow unused images to be removed. false turns image removal off.
imageCleaning.retentionCountRecent image versions to keep. At least one previous version is always kept for rollback.
imageCleaning.intervalHours24Hours 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.

KeyMeaning
requiredRequire a trusted image signature before running.
cosignKeysTrusted Cosign public keys, each with an optional name and a PEM publicKey. A signature from any key is accepted.
notationTrusted Notation certificates (caCerts) and the signer identities allowed to sign (trustedIdentities), with an optional name.

Validation summary​

The API rejects a spec when:

  • version is not 2, desiredState is not RUNNING or STOPPED, or network.mode is not bridge or host.
  • 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 tcp or udp, or a published host port repeats.
  • In host mode 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 options contain ro.
  • secrets mixes "*" with paths, repeats a path, or has a relative path.
  • resources.memory does not parse, or is outside 4Mi to 1Ti.
  • A health check has a bad test form, an interval under 5 seconds, a timeout above the interval, a duration that is not whole seconds, or an onUnhealthy other than restart or none.
  • dependsOn names an unknown service, repeats a service, forms a cycle, uses service_healthy on a service with no healthcheck, or uses service_completed_successfully on a service that restarts always.
  • More than one service sets tty.
  • An edgewire.services[].service is missing in a multi-service set or names an unknown service.
  • A service sets both command and args, a user that is not uid[:gid] or name[:group], a relative workingDir, a processDefaults other than root or image, a hostname that is not an RFC 1123 label, or restartMaxAttempts without restart: on-failure.
  • A capability is not a CAP_* name or ALL, or is in both capAdd and capDrop. A device source is not under /dev.
  • resources.cpus, memoryReservation, shmSize or stopGracePeriod does not parse, or stopGracePeriod is over 3600 seconds.
  • A service mounts a config that the set does not define, a config target is relative or under /admrl, /proc, /sys or /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.