Skip to content

Compose files

What allmyram run reads from a repo's Compose files, and what it does with each service field. How to run a job shows how to use them; How allmyram runs explains the choices.

allmyram loads Compose with compose-spec/compose-go/v2 v2.17.0, the library and version nerdctl compose uses, so merging, overrides, extends, include, profiles, ${VAR} interpolation and .env behave as they do in nerdctl. Where allmyram differs from nerdctl, this page says so.

Which files

The first of these that applies chooses the files:

Source Files
--no-compose none
--compose-file FILE, repeatable those files, merged in order, as docker compose -f does; relative paths are from the current directory
COMPOSE_FILE in the environment the files it names, as nerdctl and Docker read it; COMPOSE_FILE in .env is not read, as in nerdctl; - (standard input) is refused
discovery from the current directory upward, the first directory holding compose.yaml, compose.yml, docker-compose.yml or docker-compose.yaml (the first of these present), plus the first of compose.override.yml, compose.override.yaml, docker-compose.override.yml and docker-compose.override.yaml there, then compose.allmyram.yaml (or compose.allmyram.yml) there, loaded last

Discovery that finds files only above the repo's top level finds none. compose.allmyram.yaml is read only by discovery; list it with --compose-file or in COMPOSE_FILE to use it with either of those.

  • Every Compose file must be inside the repo after following symlinks, and so must every file the files pull in: include paths and their env_file and project_directory, extends.file, the selected services' env_file, and the .env files read without being named (the project's, and an include's that names no env_file). A reference among those that uses ${VAR} is refused, since allmyram can't tell where it leads.
  • Interpolation reads the laptop's environment, then the project's .env for what the environment lacks. The selected services' env_file contents are read on the laptop; the other services' are not read at all, so a missing one breaks nothing. The values become part of the job and travel in its request.
  • label_file is never read: labels are ignored.
  • Every profile is enabled: which services run follows depends_on alone.
  • Every service in the files needs image: or build: (a provider: service needs neither), or compose-go refuses the files, as in Docker and nerdctl.
  • compose-go's own warnings print on stderr as allmyram run: lines.

Which services

The job service is the service --service names, job by default. The job is that service, run with the command after --, plus every service it depends on, followed through depends_on, as docker compose run SERVICE does. Other services are not started and not checked against the field lists below.

Compose files Job service Result
found exists the job service and its dependencies
found missing, --service given refused
found missing, --image given, no --service --image runs the command alone, without services; a line on stderr says so
found missing, neither flag refused, naming the service and the files read
none the command alone in --image, which is required; --service is refused

A selected service's name must be a lowercase DNS label (letters, digits and -, at most 63). Compose also allows capitals and _; allmyram refuses those names rather than change them. main is reserved for the job's own container, and localhost for each container itself.

Flags on top of the job service

As docker compose run flags do:

Flag Effect on the job service
--image replaces its image
--entrypoint EXE replaces its entrypoint; --entrypoint "" runs the command with no entrypoint
--env K=V adds or replaces a variable
--workdir replaces its working_dir; relative to the repo's top level
--pad, --global-pad adds a pad, or merges onto the Compose pad of the same name: the flag's path and the options it gives replace the pad's, the rest keep their Compose values; the flag's scope must match the pad's

--cpus, --memory, --pids, --time-limit and --gpu are the whole job's: every container in the pod shares them.

The command

The command after -- replaces the job service's command and runs through its effective entrypoint, as nerdctl run and nerdctl compose run do:

The job service's entrypoint What runs
unset the image's entrypoint, with the command as its arguments
set that entrypoint, with the command as its arguments
[] or "" the command itself

--entrypoint overrides all three. Without Compose the image's entrypoint applies unless --entrypoint is given. An image with no entrypoint, such as golang, runs the command itself.

A service's entrypoint and command keep Compose's meaning: entrypoint replaces the image's entrypoint and drops its default command; command replaces only the default command.

Service fields

Every field a selected service sets is in exactly one list below.

  • A warned field is ignored with a line on stderr in nerdctl's shape, allmyram run: Ignoring: service NAME: FIELD: reason, and the job runs.
  • A refused field stops the job before it is sent, with allmyram run: service NAME: FIELD: reason. Every problem is listed at once, and run exits 125.

nerdctl ignores the fields it doesn't support, with a warning. allmyram warns too, except about fields whose loss would change what runs in a known way, which it refuses; nerdctl supports most of those, and allmyram's sandbox can't.

To drop a field allmyram refuses, override it in compose.allmyram.yaml with Compose's !reset tag, such as user: !reset null.

Used

Field What allmyram does with it
name the container's name, which every container in the pod resolves
image the container's image. It must be from a registry on the runner's allowlist and pullable without credentials. Every selected service needs one; --image can replace only the job service's
command a service's: replaces the image's default command. The job service's is replaced by the command after --. Refused: a service's command: [] without an entrypoint, since the container would run the image's default command instead
entrypoint replaces the image's entrypoint and drops its default command; [] or "" runs command itself (see The command)
environment the container's environment. A variable listed without a value that interpolation can't fill stays unset, as in Compose. HTTP_PROXY, HTTPS_PROXY and NO_PROXY, in any case, are refused: the warden sets them
env_file read on the laptop into the container's environment; each file must be inside the repo
working_dir the container's working directory. The job service's must be /workspace (the repo) or under it, unless --workdir replaces it
healthcheck the service's readiness check; see Healthchecks
depends_on which services join the job, and when each container starts; see Waiting for services
container_name an extra name in the pod's hosts file; must be a hostname (letters, digits, - and .)
networks only the default network. Its aliases are extra names in the hosts file and must be hostnames; its other settings are warned about, as networks.default.FIELD: not supported. Any other network is refused: the containers expect namespaces arranged differently
hostname warned: the name goes into the hosts file, but the container still reports the pod's hostname
ports the container side is a port the service listens on, for the port check; the published side is ignored without a warning
expose ports the service listens on, for the port check: PORT, PORT/PROTOCOL or FIRST-LAST[/PROTOCOL]; anything else is refused
volumes named and anonymous volumes; see Volumes
profiles nothing: every profile is enabled and selection follows depends_on

Ignored without a warning

Field Notes
labels
restart "no" only. Any other policy is warned: a service that exits is not restarted
pull_policy missing or if_not_present only, which is what the runner does. Any other value (always, never, build, a period) is refused: the runner pulls only images it lacks, so a moved tag would silently run the cached image
x-* extension fields. x-allmyram on a service is warned: allmyram reads it only on top-level volumes

Ignored with a warning

Field Reason
mem_limit, cpus the job's pod-wide limits apply instead
deploy deploy.resources: the job's pod-wide limits apply instead. deploy.resources.reservations.devices is refused: a GPU request with "Compose's GPU syntax is not supported; use --gpu", any other device with "the process expects powers it won't have". deploy.restart_policy is treated as restart. deploy.replicas is ignored silently when it is 1 and otherwise refused, as scale is. Any other deploy.*: not supported
links not supported; the service's name resolves anyway. A link with an alias other than the service's name (db:database) is refused: the alias wouldn't resolve
tmpfs the path is ordinary per-run storage on disk, except at or under /tmp (see Volumes); at or under a pad's path it is in the pad
init, stop_signal, stop_grace_period, logging, sysctls, ulimits, shm_size, security_opt, cap_drop, read_only not supported
any field not named on this page, such as develop not supported, as nerdctl does with fields it doesn't know

Refused

Field Reason
build without image: allmyram does not build images, and there is no image to pull. With image it is only warned: the image is pulled, not built
privileged, cap_add, devices, use_api_socket the process expects powers it won't have
network_mode, pid, ipc, userns_mode, uts, cgroup the containers expect namespaces arranged differently
user the process would run as a different user
group_add the process would run with different groups
platform the image would be another architecture's
extra_hosts, external_links those names wouldn't resolve
secrets, configs the files wouldn't exist
gpus Compose's GPU syntax is not supported; use --gpu
volumes_from those volumes wouldn't be mounted
runtime the container would run under a different runtime
pre_start, post_start, pre_stop those hooks wouldn't run
models the models wouldn't be provided
provider a provider service has no container allmyram can run
scale, deploy.replicas, other than 1 allmyram runs exactly one container per service

Healthchecks

test Runs
["CMD", PROGRAM, ARG...] the program directly, in the service's container; no shell needed. nerdctl turns this form into a shell command
["CMD-SHELL", SCRIPT], or a string /bin/sh -c SCRIPT in the service's container
["NONE"], or disable: true nothing: the service has no healthcheck

Timings and retries left unset or set to zero take these defaults, as in Docker and nerdctl:

Field Default Meaning
interval 30s time between checks after the start period
timeout 30s a check running longer fails
retries 3 failed checks in a row, after the start period, that end the run
start_period 0s time after the service starts in which failures don't count
start_interval 5s time between checks during the start period

As in Docker, the first check runs one interval after the service starts: start_interval during the start period, interval after it. A healthcheck that sets only test therefore runs its first check 30 seconds after the service starts. An image's own HEALTHCHECK is not read.

Waiting for services

condition The dependent container starts
service_started (the default) once the dependency's container has started
service_healthy once the dependency has passed its healthcheck; refused when the dependency has no healthcheck
service_completed_successfully refused: the order it promises wouldn't hold

required: false is warned about (the dependency is started all the same), and so is restart: true (nothing is restarted during a run). nerdctl ignores service_healthy and starts the dependent container at once; allmyram waits, as Docker does.

Services start first and the job's own container last. A service that exits before it is healthy, or fails retries checks after its start period, ends the run as StartFailed. The detail names the service and gives the last check's output and the end of the service's log, at most 4 KiB each. A check that can't run in the service's image (no such program, or no /bin/sh for CMD-SHELL) ends the run the same way, saying so.

Volumes

Mount Becomes
named volume per-run storage: the path in that container's own filesystem, on disk, starting with what the image has there, gone with the run
named volume whose top-level definition has x-allmyram: {pad: ...} a scratch pad
anonymous volume per-run storage
type: tmpfs warned: the path is ordinary per-run storage on disk, or in the pad when it is at or under a pad's path
bind mount refused: bind mounts are not supported
any other type refused: only named volumes are supported

/tmp is the exception to "on disk" when the image's /tmp is empty, as most images' is, and the image doesn't declare a VOLUME there: gVisor then mounts its own memory-backed tmpfs at /tmp. A per-run named volume, anonymous volume or tmpfs at or under /tmp is then held in memory and counts against --memory. When the image has files in /tmp, or declares VOLUME /tmp, /tmp is on disk like any other path. A pad can't be mounted at /tmp, but can be under it, and what is at or under a pad's path is in the pad, on disk. Put large scratch files elsewhere, such as /var/tmp.

Also refused:

  • a per-run volume mounted by more than one selected container: a volume can't yet be shared between containers;
  • a per-run volume mounted ro, since writes Compose would deny would succeed;
  • nocopy and subpath on a mount;
  • a top-level volume that is external, has a driver other than local, or has driver_opts;
  • a named volume mounted at or under /workspace in the job service: the workspace mount would hide it.

A pad is declared on the top-level volume; its name is the volume's name:

volumes:
  uv-cache:
    x-allmyram:
      pad: {scope: global, max: 10G}
Key Default Meaning
scope repo repo or global, as --pad and --global-pad
max none soft size limit, such as 10G

pad: with no value is a repo pad. The mount's own ro option mounts the pad read-only. Pads are mounted only into the job service; a pad volume mounted by another service is refused, and so is any other key under x-allmyram or pad. A Mac runner refuses jobs with pads.

Names and ports

Every container of the job mounts one hosts file, read-only, at /etc/hosts. It maps each of these names to 127.0.0.1 and ::1: localhost, the pod's hostname (the run ID), every service's name, every container_name, default-network alias and hostname, and the job service's own name. No two containers may share a name, compared without case, and localhost can't be a service's name or an extra name.

Every container, services included, gets HTTP_PROXY and HTTPS_PROXY pointing at the runner's proxy, and NO_PROXY listing localhost, 127.0.0.1, ::1 and the names above.

Every container shares one localhost. Two selected services that declare the same port and protocol (the container side of ports, or expose) are refused, naming both. allmyram can't check ports nobody declared; a clash there shows up as a service that fails to listen.

Containers

The job's container A service's container
user the runner's uid, with no capabilities and no new privileges the image's, with containerd's default capabilities
HOME /tmp unless the job sets it the image's
mounts the repo at /workspace, its pads, the hosts file the hosts file
log streamed to the client NAME.log on the runner; its end appears in a start failure

All of them run in one gVisor pod, inside the job's limits.