Docker Compose
Docker Compose is an open standard, the Compose Specification, for describing a set of containers. Admiral reads and writes it. A configuration can start as a docker-compose.yml, be edited as one, and come back out as one. The conversion runs in Admiral, so the dashboard, the CLI, the API and the MCP server give the same result.
Admiral does not run Docker Compose. A compose file is another way to write a multi-service configuration. Keys that have an equivalent on an Admiral device are mapped. Keys that do not are dropped with a warning or refused with an error that names the key. See the compose key reference for every key.
There are three operations:
| Operation | What it does |
|---|---|
| Import | Creates a configuration from a compose file. |
| Export | Writes one version of a configuration as a compose file. |
| Update | Saves an edited compose file as a new version of an existing configuration. |
Settings that Compose cannot express, such as EdgeWire services, the image signature policy, registry credentials and volume backups, are written under an x-admrl key. Docker Compose ignores that key. See the x-admrl reference.
Each issue the conversion reports names the compose path it refers to, for example services.db.restart. A warning means the conversion changed or ignored something. An error means it cannot continue, and nothing is created or saved.
Import a compose file
Start with a file for three services:
name: shop
services:
app:
image: ghcr.io/example/shop-app:2.3
environment:
- NODE_ENV=production
- DATABASE_URL=postgres://shop@db:5432/shop
- REDIS_URL=redis://redis:6379
ports:
- "3000:3000"
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
db:
image: postgres:16
environment:
POSTGRES_USER: shop
POSTGRES_PASSWORD: change-me
POSTGRES_DB: shop
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U shop -d shop"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
redis:
image: redis:7
command: ["redis-server", "--appendonly", "yes"]
volumes:
- redisdata:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5
restart: unless-stopped
volumes:
pgdata:
redisdata:
Dashboard. Open Configurations, choose New configuration, then pick Import docker-compose.yml as the source. Paste the file or load it, optionally list profiles in the Profiles field, and choose Check compose file. Read the issues, then choose Create configuration.
CLI. apply --compose creates the configuration when the name does not exist yet:
admrl apply --compose -f docker-compose.yml --name shop
admrl apply --compose -f docker-compose.yml --name shop --dry-run # translate and report, create nothing
Without --name, the name is the file's top-level name:.
API. POST /v1/configurations:importCompose translates the file and returns spec, warnings and errors. It creates nothing. Creating the configuration is a separate POST /v1/configurations with the returned spec.
This file imports with three warnings, one per service, because Admiral has no unless-stopped:
services.app.restart unless-stopped became always: Admiral restarts the service until the configuration stops it
services.db.restart unless-stopped became always: Admiral restarts the service until the configuration stops it
services.redis.restart unless-stopped became always: Admiral restarts the service until the configuration stops it
Importing creates a configuration. It does not assign it to a fleet or start anything.
Export a configuration
Export writes a version of a configuration as a compose file:
admrl get configuration shop -o compose > docker-compose.yml
admrl get configuration shop -o compose --version 3 > shop.v3.yml
In the dashboard, open the configuration, choose Manage > Compose, and choose Download. Over the API:
curl -sS "https://api.admrl.co/v1/configurations/$CONFIG_ID:exportCompose?version=3" \
-H "X-Organization-ID: $ADMIRAL_ORG" -H "X-API-Token-ID: $TOKEN_ID" -H "X-API-Secret-Key: $TOKEN_SECRET"
The response is the YAML itself. Send Accept: application/json to get {compose, warnings, version} instead, and add ?download=1 to get a Content-Disposition file name. Exporting needs permission to view the configuration.
The file for the shop configuration above starts like this:
# Admiral configuration shop (5c0f3b4e-1a2b-4c3d-8e9f-0a1b2c3d4e5f) version 1.
# x-admrl keys carry Admiral-only settings; docker compose ignores them.
name: shop
x-admrl:
version: 1
configuration:
id: 5c0f3b4e-1a2b-4c3d-8e9f-0a1b2c3d4e5f
name: shop
version: 1
services:
db:
image: postgres:16
environment:
POSTGRES_DB: "shop"
POSTGRES_PASSWORD: "change-me"
POSTGRES_USER: "shop"
volumes:
- pgdata:/var/lib/postgresql/data
restart: always
healthcheck:
test: [CMD-SHELL, pg_isready -U shop -d shop]
interval: 10s
timeout: 5s
retries: 5
What to expect from an export:
- It is deterministic. The same version always exports the same bytes, so a compose file kept in Git diffs cleanly.
restartis always written, because the Compose default (no) differs from Admiral's (always).- Healthcheck timings and both sides of each port are always written.
- Environment values are exported as stored. For each variable whose name looks like a credential (
password,secret,token,api_key,private_keyorcredential) with a value, the export carries a warning: herePOSTGRES_PASSWORD looks like a credential: move it to a secret file. The dashboard shows the warnings before it downloads. Do not commit those values. Use secret files and asecretsentry instead. - A version that cannot be written as Compose answers
409withcompose_export_unsupported. Only configurations created before multi-service workloads that use host namespaces other than network are affected.
Exporting a draft that is not saved yet is also possible: POST /v1/configurations:exportCompose takes {spec, name?}. The dashboard uses it for Includes unsaved changes.
Update a configuration from a compose file
Export, edit, and send the file back. Admiral saves it as a new version only if you based it on the latest version.
- Export the configuration. The file records the configuration ID and version in
x-admrl.configuration. - Edit the file.
- Check it: Admiral translates the file against the version it was based on and reports the warnings, the errors, a diff of what would change, and any settings carried over (see below). Nothing is saved.
- Save it. Admiral creates the next version, with the same checks and the same fleet checks as saving in the editor. Your change reason, or
Updated from compose (based on version N), is recorded on the version.
With the CLI, the same update is one command. It prints the warnings, the settings carried over and the diff, then asks before it saves:
admrl get configuration shop -o compose > shop.yml # edit shop.yml, then:
admrl apply --compose -f shop.yml --configuration shop --dry-run
admrl apply --compose -f shop.yml --configuration shop
--yes saves without the prompt. A file read from stdin (-f -) needs --yes to save, or --dry-run to only check.
If the file is identical to the base version, the answer says unchanged and no version is created. If the file has errors, the answer is still 200, with spec: null and the errors listed, and nothing is saved. The CLI prints each error with its compose path, changes nothing and exits with code 1.
The base version
Every update names the version the file was based on, and Admiral refuses it if the configuration has moved on. The base is, in order:
baseVersionin the request, or--base Nin the CLI,x-admrl.configuration.version, whenx-admrl.configuration.idis this configuration's ID,- otherwise the latest version. The API instead fails with
400 base_version_required. The CLI prints a note that it compares with the current version.
--base latest in the CLI names the latest version explicitly.
What carries over
The x-admrl block decides what a missing setting means.
- The file has a top-level
x-admrl. It is the whole truth. Whatever it omits is removed, so exporting, editing and saving never keeps a stale setting. - The file has no
x-admrl, for example a hand-writtendocker-compose.yml. Admiral keeps the Admiral-only settings of the base version, so a plain compose file does not silently remove EdgeWire services or an image signature policy. Every kept setting is listed incarriedOver, with the version it came from:
| Kept from the base version | Compose path in carriedOver |
|---|---|
| EdgeWire services | x-admrl.edgewire |
| Signature policy | x-admrl.signaturePolicy |
| Set options | x-admrl.options |
desiredState: STOPPED | x-admrl.desiredState |
| Volume backup, options and source | volumes.<name>.x-admrl |
| Registry credential of a service | services.<name>.x-admrl.registryCredentialId |
secrets: ["*"] of a service | services.<name>.x-admrl.secrets |
tty, ephemeralRoot | services.<name>.x-admrl.tty, .ephemeralRoot |
processDefaults | services.<name>.x-admrl.processDefaults |
onUnhealthy: none | services.<name>.x-admrl.onUnhealthy |
If a kept EdgeWire service points at a service the file removes, that is an error. Remove the EdgeWire service in x-admrl, or keep the service.
Version conflicts
If someone saves a version after the one your file was based on, Check and Save both answer 409 base_version_conflict:
{
"error": "base_version_conflict",
"baseVersion": 7,
"currentVersion": 8,
"updatedAt": "2026-11-04T01:02:03Z"
}
Admiral never merges. Look at what version 8 changed, then re-check your file against version 8. The diff then shows exactly what saving would overwrite.
In the dashboard the Compose tab shows a banner with Show changes in v8, Re-check against v8 and Download my file. The CLI exits with code 3 and suggests --base latest.
The Compose tab
The Compose tab is under Manage in the configuration's navigation. It is hidden when your Admiral backend does not offer Compose.
- The editor opens on the export of the version you are looking at. If you have unsaved edits in other tabs, it exports the draft and says Includes unsaved changes.
- Update from file loads a compose file into the editor. Download saves the editor text. Download warns first about values that look like credentials.
- Check runs the update check against the version you started from. On success it shows the diff and the settings carried over, and loads the result into the other tabs, which show the pending changes.
- Save as new version is enabled only after a successful Check of the text in the editor. After saving, the editor shows the canonical export of the new version and says how many changes were normalised.
- If you edit other tabs after a Check, the Compose tab marks itself stale. Choose Re-export or Re-check, or save from the normal Review and save flow.
- Saving needs permission to edit the configuration. Check and Download need only view access.
CLI
admrl get configuration <name|id> -o compose [--version N]
admrl apply --compose -f <file|-> [--name NAME | --configuration <id|name>] [--base N|latest] [--profiles a,b] [--resolve] [--dry-run] [--yes] [--reason TEXT]
| Flag | Meaning |
|---|---|
-o compose | Print a version as a compose file. --version N picks the version, default latest. Warnings go to stderr. |
--name | Create the configuration, or update it when a configuration with that name exists. Without it, the file's top-level name: is used. |
--configuration | Update this configuration, by name or ID. Cannot be combined with --name. |
--base | The version the file is based on: N, or latest. Default: x-admrl.configuration.version, else the latest version. |
--profiles | Compose profiles to enable, comma separated or repeated. |
--resolve | Read files on your machine before upload: ${VAR} from the shell and .env, include, extends, env_file (inlined into environment), and file binds (inlined as config files). No Docker install is needed. |
--dry-run | Check and report. Save nothing. |
--yes | Save an update without the prompt. |
--reason | The change reason recorded on the new version. |
Without --resolve the file is sent as written, and the server does not read anything next to it. A file bind then becomes an empty config (see file binds).
Exit codes: 0 success, 1 error (a compose error, or the server refused the file and nothing changed), 2 usage (for example --name with --configuration), 3 conflict. A conflict is a base version that is no longer the latest, or a fleet whose security policy refuses the new version. For a conflict the CLI names who saved the newer version and when, and suggests --base latest or re-exporting.
The CLI checks compose files with the same server translation as the dashboard and the API, so the output matches them.
Compose-only flags are rejected on the other forms of apply, and admrl diff has no compose mode. Use apply --compose --dry-run to see what an update would change.
MCP
Two MCP tools do the same export and update: export_configuration_compose returns a version as compose YAML, and import_configuration_compose checks a file and, when told to, saves it. The MCP server accepts a compose file of 256 KiB.
Config files from file binds
A compose file often bind-mounts a config file: ./mosquitto.conf:/mosquitto/config/mosquitto.conf. A device has no host paths to bind, so Admiral stores the file in the configuration instead, as a config file: managed text that the device writes and mounts read-only at the target path.
services:
broker:
image: eclipse-mosquitto:2
ports:
- "1883:1883"
volumes:
- ./mosquitto.conf:/mosquitto/config/mosquitto.conf:ro
- mosquitto-data:/mosquitto/data
restart: always
volumes:
mosquitto-data:
Import this with the CLI, with --resolve, next to a mosquitto.conf containing:
listener 1883
allow_anonymous true
persistence true
persistence_location /mosquitto/data/
The CLI reads the file and uploads the content. The configuration exports as:
services:
broker:
image: eclipse-mosquitto:2
ports:
- "1883:1883"
volumes:
- mosquitto-data:/mosquitto/data
restart: always
configs:
- source: mosquitto.conf
target: /mosquitto/config/mosquitto.conf
volumes:
mosquitto-data: {}
configs:
mosquitto.conf:
content: |
listener 1883
allow_anonymous true
persistence true
persistence_location /mosquitto/data/
This is the standard Compose configs syntax with inline content. A docker compose that reads the exported file mounts the same text.
Rules:
- Where the content comes from. The CLI reads the file relative to the compose file, with
--resolve. The dashboard and the API cannot read your disk, so a file bind there creates the config empty and warns:config mosquitto.conf was created empty from bind ./mosquitto.conf; fill it in the dashboard (Configs) or with admrl apply --compose --resolve. An empty config is a real, empty file on the device. Fill it in on the Config files page of the configuration (in the Shared group of its navigation), or in the YAML view or the Compose tab, and save. Or import again with the CLI and--resolve. - Names and sharing. The config is named after the file. A second file with the same name gets a
-2suffix. Two services that bind the same file share one config. - Size and type. At most 256 KiB per file and 1 MiB per configuration, and UTF-8 text only. Binary files, and anything that holds a password or key, belong in secret files. Configs are stored in the version, visible to anyone who can view the configuration, and exported as written.
- Mount. Configs are always read-only. The target must be an absolute path that is not under
/admrl,/proc,/sysor/dev. Optionalmode(at most0777, default0444),uidandgidset the file's owner and permissions. Without them the file is owned by the service's user. - Changes. A new content is a new configuration version. The device rewrites the file and recreates only the services that mount it.
- Unused configs. A config that no service mounts imports with a warning and is kept.
- Directories. A bind of a directory, such as
./data:/data, becomes a named volume with that name. The contents are not uploaded and the volume starts empty. Each one warns:bind ./data became the named volume data: the contents of ./data are not uploaded; the volume starts empty. Without a local file system, a bind whose last path element has an extension is treated as a file, anything else as a directory.
Binds that are accepted without becoming a config or volume:
| Bind | Result |
|---|---|
/dev/... | A device mount. |
/etc/localtime, /etc/timezone | Dropped with a warning. Set the TZ environment variable. |
/run/dbus, /var/run/dbus | Becomes the set option exposeDBus, which exposes the host system D-Bus socket to every service. Warns. |
Any other absolute host path, including /var/run/docker.sock, is an error.
Profiles
Compose profiles select which services run. Admiral applies them when the file is translated, as Compose does: a service with profiles: is left out unless one of its profiles is requested. Each service that is left out warns: dropped: its profiles (debug) are not requested.
Request profiles with the Profiles field when you import in the dashboard, --profiles in the CLI, or profiles (a list in the JSON body, or ?profiles=a,b) in the API. The device never sees the profiles: the configuration contains only the services that were selected. If every service is excluded, the import fails.
What the round trip guarantees
Admiral to compose to Admiral is lossless. Compose to Admiral to compose is normalised.
- Export, then import the same file. The configuration comes back equal, with zero warnings and zero errors. Updating a configuration from its own unmodified export answers
unchanged. - Export, import and export again. The second export is byte-identical to the first.
- Import normalises a hand-written file. The result reads the same way for the device, but its text is canonical. Each change that alters meaning is a warning. The usual ones are:
unless-stoppedbecomesalways, a missingrestartbecomesalways, a port with only a container port gets the same host port, short and long forms converge,mem_limitmoves todeploy.resources.limits.memory, units are canonical, and${VAR:-default}resolves to its default. Comments, anchors, aliases and merge keys are resolved or dropped, and so are services excluded by profiles. - Other
x-*keys are dropped. Keys other thanx-admrlare not kept, with one warning that lists them. Most are YAML anchor scaffolding, and the configuration stores only validated settings.
Where Admiral differs from Docker Compose
Each difference below is reported as a warning when it applies.
| Compose behaviour | On an Admiral device |
|---|---|
restart defaults to no. | Missing restart becomes always. unless-stopped also becomes always. |
command replaces the image CMD and keeps the ENTRYPOINT. | The same. It is stored as args. entrypoint replaces the ENTRYPOINT and clears the image CMD. |
Processes run as the image's USER in the image's WORKDIR. | Imported services use the image defaults too (processDefaults: image). Services written without Compose run as root in / unless they set user and workingDir. |
1G and 1g mean 2^30 bytes. | Memory and shm_size quantities are parsed as binary and stored as Gi, Mi or Ki. |
| An unhealthy container keeps running. | An unhealthy service is restarted by default. Set x-admrl.onUnhealthy: none to only report it. See Health checks. |
tty: true allocates a pseudo-terminal. | Ignored with a warning. Giving a service the device screen and keyboard is x-admrl.tty. |
| A healthcheck defaults to a 30 second timeout. | Defaults are written out explicitly. An interval under 5 seconds is raised to 5, and a timeout above the interval is lowered to it, each with a warning. test is required: Admiral does not read the image's own HEALTHCHECK. |
| Services join networks. | Every service joins the one set network and reaches the others by name. Only aliases are kept. |
container_name names the container. | Ignored. Containers are named <instance>-<service>. |
privileged, cap_add and devices work on any host. | Mapped, but a fleet must allow them. See Workload host access. |
Host access and agent features
A compose file can ask for more than a fleet allows or a device can run. Both checks apply to an imported or updated configuration exactly as they do to one you edit by hand. Neither blocks creating a configuration. They apply when the configuration is assigned to a fleet, rolled out, or saved as a new version of an assigned configuration.
- Fleet host access.
privileged,cap_addof powerful capabilities,devices, and the hostpidandipcnamespaces are refused when a fleet's security policy does not allow them. Check reports it as a warning for each fleet the configuration is assigned to. Saving a new version of an assigned configuration is refused with409 host_access_not_allowed. A user with the Edit security policy capability sets the allowance in the Workload host access card under Policy > Security. See Workload host access. - Agent features. Some keys need a newer device agent. A service that uses them gets the warning
needs agent features health, deps.healthy; devices whose agent lacks them refuse it. Assigning the configuration to a device without them is refused with409 unsupported_by_agent. See Agent features.
Limits
| Limit | Value |
|---|---|
| Compose file | 1 MiB (the MCP server accepts 256 KiB). |
| One config file | 256 KiB, UTF-8 text. |
| All config files in a configuration | 1 MiB. |
| Profiles in one request | 32. |
x-admrl.version | 1. A newer version is an error: written by a newer Admiral. |
For Compose features that are mapped, ignored or refused, see the compose key reference.