Compose Key Reference
This page lists what Docker Compose keys become in a configuration, and every key of the x-admrl extension. Each warning and error names the compose path it refers to, for example services.db.healthcheck.interval.
Some keys need a feature of the device agent. The feature is listed so you know what a device must report before it accepts the configuration. See Agent features.
Service keys that are mapped
| Compose key | Becomes | Notes |
|---|---|---|
image | image | Required. |
entrypoint | command | entrypoint and command together become one argv. Setting an entrypoint clears the image CMD, as in Docker. An empty entrypoint with no command is an error. |
command (alone) | args | Replaces the image CMD and keeps the image ENTRYPOINT. Needs process.args. |
environment | environment | Map or KEY=value list. A list entry with no value (- KEY) is an error, because Compose would read it from your shell. ${VAR:-default} takes the default, with a warning. Other variables are errors: substitute them first or use --resolve. |
ports | ports | Short and long forms. "3000" alone publishes host port 3000 and warns. Port ranges and host addresses (127.0.0.1:80:80) are errors. |
volumes (named) | volumes | Must be declared under the top-level volumes. :ro becomes readOnly. Anonymous volumes, nocopy and subpath are errors. |
volumes (bind) | Volume, config, mount or option | See file binds. /dev/... becomes a device mount. |
tmpfs, volumes with type: tmpfs | mounts of type tmpfs | size and mode are kept. |
configs | configs | Short and long syntax. Needs configs. |
depends_on | dependsOn | Conditions service_started, service_healthy and service_completed_successfully. restart: and required: are ignored with a warning. |
healthcheck | healthcheck | Needs health. See below. |
restart | restart, restartMaxAttempts | no, always, on-failure and on-failure:N. unless-stopped becomes always, with a warning. A missing restart becomes always, with a warning. |
user | user | uid[:gid] or name[:group]. Needs process.user. |
group_add | groupAdd | Needs process.user. |
working_dir | workingDir | Needs process.user. |
hostname | hostname | Needs net.names. |
labels | labels | Needs labels. |
devices | devices | Sources under /dev only. CDI device names are an error. Needs devices. Gated by host access. |
privileged | privileged | Needs security.privileged. Gated by host access. |
cap_add, cap_drop | capAdd, capDrop | Needs security.caps. cap_add of a powerful capability is gated by host access. |
network_mode | network.mode | host applies to the whole set and warns. bridge is accepted. none, service: and container: are errors. |
networks | aliases | Every service joins the one set network. Only each service's aliases are kept, with a warning. ipv4_address and similar keys are errors. Needs net.names. |
extra_hosts | extraHosts | host:ip. host-gateway is accepted as the IP. Needs net.names. |
dns, dns_search, dns_opt | dns.servers, dns.search, dns.options | Needs net.dns. |
ulimits | ulimits | One number or {soft, hard}. Needs limits.ulimits. |
sysctls | sysctls | Namespaced keys only. Needs limits.sysctls. |
shm_size | shmSize | Needs limits.shm. |
stop_signal, stop_grace_period | stopSignal, stopGracePeriod | Whole seconds. Needs stop. |
init | init | Runs a small init process that reaps stray child processes. Needs init. |
read_only | readOnlyRoot | |
mem_limit, deploy.resources.limits.memory | resources.memory | Binary units: 1G is 2^30 bytes. |
cpus, deploy.resources.limits.cpus | resources.cpus | At most three decimals. Needs limits.cpu. |
pids_limit, deploy.resources.limits.pids | resources.pids | Needs limits.pids. |
mem_reservation, deploy.resources.reservations.memory | resources.memoryReservation | Needs limits.memlow. |
deploy.restart_policy | restart, restartMaxAttempts | any is always, on-failure with max_attempts, none is no. delay and window are ignored. |
secrets | secrets | Paths under /admrl/secrets/. The file, environment and external sources are not read: upload the files as secret files. Each secret warns with the path to upload. uid, gid and mode are ignored. |
profiles | Selects services, see Profiles. | |
x-admrl | Admiral-only service settings | See x-admrl. |
Healthchecks
test is required, and must start with CMD or CMD-SHELL. A string becomes CMD-SHELL. NONE and disable: true remove the check. Admiral cannot read the image's own HEALTHCHECK, so a service that relies on it needs the check written out.
Missing timings take the Compose defaults: interval 30 seconds, timeout 30 seconds, 3 retries, no start period. Admiral then applies its own limits and warns when it changes a value:
| Compose | Result |
|---|---|
interval under 5 seconds | Raised to 5 seconds. |
timeout above interval | Lowered to the interval. |
start_interval | Ignored. Probes run at the interval from the start. |
retries: 0 | Treated as 3. |
| A duration that is not whole seconds | Rounded up to whole seconds, with a warning. |
Service keys that are ignored
These keys are accepted. Each one raises the warning ignored: <reason>.
| Compose key | Reason |
|---|---|
container_name | The container is named <instance>-<service>. |
domainname | The domain name is not configurable. |
annotations | Use labels. |
gpus, deploy.resources.reservations.devices | NVIDIA devices are exposed automatically on NVIDIA platforms. |
expose | Services on the set network reach every port of each other. |
logging | Admiral collects service output. |
tty, stdin_open | A compose tty is a pseudo-terminal. Giving a service the device screen is x-admrl.tty. |
pull_policy, platform | The device pulls the image for its own architecture. |
build (when image is set) | The image is pulled. Without image, build is an error. |
security_opt: no-new-privileges:true | Services never gain new privileges. Any other security_opt is an error. |
scale: 1, deploy.replicas: 1 | A service always runs one container. Other values are errors. |
deploy.update_config, rollback_config, labels, endpoint_mode | Admiral rolls out configuration versions itself. |
version (top level) | Obsolete in Compose, ignored. |
Keys that are errors
These stop the import. The error reads <key> is not supported: <reason>.
| Compose key | Reason or alternative |
|---|---|
env_file | The server cannot read files. Inline the variables, or use admrl apply --compose, which inlines them. |
extends, include | Inline the extended service, or use admrl apply --compose --resolve. |
links, external_links | Services reach each other by service name. Remove them. |
scale, deploy.replicas above 1; deploy.mode: global; deploy.placement | A set runs one copy of each service on one device. |
pid, ipc, uts, userns_mode, cgroup, cgroup_parent | Namespaces and cgroups are managed by the device. |
cpu_count, cpu_percent, cpu_shares, cpu_quota, cpu_period, cpu_rt_runtime, cpu_rt_period, cpuset | Use cpus. |
oom_kill_disable, oom_score_adj, mem_swappiness, memswap_limit, blkio_config, device_cgroup_rules | Not supported. |
isolation, runtime, storage_opt, mac_address, credential_spec | Not supported. |
post_start, pre_stop, develop, provider, models, use_api_socket, attach, volumes_from, label_file | Not supported. |
Absolute bind sources other than /dev, /etc/localtime, /etc/timezone and /run/dbus | Use a named volume, or a config for a file. |
Top-level volumes.<name>.external | Volumes are created on the device. |
configs.<name>.environment, external, name, template_driver | Provide the text as content. |
| Any other key | unknown service key. A typo cannot be saved silently. |
A service name must match ^[a-z][a-z0-9_-]{0,31}$ and must not be ssh, exec or debug. Names are not rewritten, because a service name is a host name.
Top-level networks is ignored with a warning. Top-level secrets entries are read for their names only. Top-level x-* keys other than x-admrl are dropped with one warning that lists them. Top-level volumes.<name> keys driver, driver_opts, labels and name are ignored with a warning, because volumes are local to the device. A top-level configs.<name> takes content; with file it is created empty by the server, and the CLI fills it from the file.
x-admrl
x-admrl carries what Compose cannot express, so an exported file is the whole configuration. Docker Compose ignores it. Its keys are the configuration spec's own keys, in camelCase, and are checked as strictly as the spec: an unknown key or a wrong type is an error at its path, for example x-admrl.options.hostResolv.
version is required. This release reads and writes version 1. A file with a higher version is rejected with written by a newer Admiral.
Top level
x-admrl:
version: 1
configuration:
id: 5c0f3b4e-1a2b-4c3d-8e9f-0a1b2c3d4e5f
name: shop
version: 7
desiredState: STOPPED
edgewire:
services:
- { name: web, protocol: tcp, port: 8080, service: web }
signaturePolicy:
required: true
options:
hostResolv: true
| Key | Meaning |
|---|---|
version | Required. 1. |
configuration.id, .name, .version | Where the file came from. Written by export. When id is the configuration being updated, version is the default base version. They are never applied. name names the configuration on create when the file has no top-level name. |
desiredState | RUNNING or STOPPED. Omitted when RUNNING. |
edgewire | EdgeWire services, as in the spec. |
signaturePolicy | Image signature trust for the set, as in the spec. |
options | Set options, as in the spec. Only keys that differ from the default are written. |
options accepts hostResolv, hostHosts, isolateDevices, exposeDBus, disableHostBluetooth and imageCleaning (enabled, retentionCount, intervalHours, maxAgeDays, pruneOnUpdate, pruneDangling). It also accepts newPrivileges, privileged, parentCgroupDevices, cgroup, maskedPaths, readonlyPaths, capabilities and devices, which exist for compatibility with older configurations and are not applied by current devices. Use the per-service privileged, cap_add and devices keys instead.
Per service
services.<name>.x-admrl is written last in each service.
| Key | Value | Spec field | Written when |
|---|---|---|---|
registryCredentialId | string | registryCredentialId | The service has a registry credential. |
secrets | all | secrets: ["*"] | The service sees every secret file in scope. |
tty | boolean | tty | The service owns the device screen and keyboard. |
ephemeralRoot | boolean | ephemeralRoot | The service uses a temporary root layer. |
processDefaults | root | processDefaults | The service runs as root in /. Services without this key use the image's USER, WORKDIR and STOPSIGNAL. |
onUnhealthy | none | healthcheck.onUnhealthy | An unhealthy service is only reported, not restarted. Needs a healthcheck. |
mountOptions | map, target to list | mounts[].options | A device bind mount has options other than the rbind and ro that its compose form implies. |
mountOrder | list of targets | order of mounts | Mount targets nest and their order matters. |
secrets: all cannot be combined with a secrets: list on the same service.
Per volume
volumes.<name>.x-admrl holds settings that Compose has no key for.
| Key | Meaning |
|---|---|
backup.enabled | Take backup snapshots of the volume. |
options | Linux mount options such as rbind and rw. ro makes every attachment read-only. |
source | Legacy host source directory carried over from older configurations. |
Example
name: edge-stack
x-admrl:
version: 1
edgewire:
services:
- { name: web, protocol: tcp, port: 8080, service: web }
services:
web:
image: ghcr.io/example/web:1.4
ports:
- "80:8080"
restart: always
x-admrl:
registryCredentialId: 5c0f3b4e-0000-0000-0000-000000000000
processDefaults: root
volumes:
data:
x-admrl:
backup:
enabled: true