How to run a job on a runner¶
You need a set-up laptop and at least one runner. The command line reference lists every flag and exit code.
Run a command¶
From anywhere inside a git working tree:
The job runs against your working tree as it is now: tracked changes, plus
untracked files that .gitignore doesn't exclude. Output streams back to your terminal, and
allmyram run exits with the job's exit status.
- If the job needs more than 4 CPUs or 4 GiB, add
--cpusand--memory. - If it should run in a subdirectory, add
--workdir DIR, relative to the repo's top level. - If it needs environment variables, add
--env K=Vfor each. - If it may run longer than the runner's default (normally 2 hours), add
--time-limit.
The image must be in a registry on the runner's allowlist and pullable without credentials. A snapshot holding Git LFS files is refused, naming the files.
The command runs through the image's entrypoint, as docker run IMAGE
COMMAND does. Images without one, such as golang, run the command
itself. Before Compose support, allmyram replaced the image's entrypoint
with the command; if your image has an entrypoint and the command should
run without it, use --entrypoint "" to run the command directly, as with
nerdctl run, or give the job a Compose service with entrypoint: [] (see
below).
If the repo has Compose files, run reads them first; see the next
section. Add --no-compose to ignore them.
Run with your Compose services¶
If your repo already describes its services in Compose, a job can run with them: allmyram starts the services your job depends on beside it, waits for the ones it needs healthy, then runs your command.
Add a service named job for the job itself, in compose.allmyram.yaml
beside your compose.yaml (allmyram loads it last, and Docker doesn't read
it):
services:
job:
image: docker.io/library/python:3.14
profiles: [allmyram] # keeps `docker compose up` from starting it
depends_on:
postgres: {condition: service_healthy}
environment:
DATABASE_URL: postgresql://app:app@postgres:5432/app
Then run from anywhere in the repo, without --image:
The job is the job service plus every service it depends on, as
docker compose run job just check would start; other services don't run.
Your command replaces the service's command. Containers reach each other
by service name. Compose files lists what
allmyram does with every field.
- If you want to see what your Compose files became without running
anything, add
--dry-run; it prints the job as JSON and needs no--runner. -
If the job must wait until a service is ready, give that service a
healthcheckand depend on it withcondition: service_healthy. Set its timings: as in Docker, the first check runs one interval after the service starts, so a healthcheck that sets onlytestholds the job back 30 seconds. Check the way the job will connect: Postgres's image first runs a temporary server that listens only on its unix socket, sopg_isreadywithout-h localhostcan pass before the real server takes TCP connections. For example: -
If a service's image has no shell or no tool to check itself with, add a small probe service whose image does: have it sleep (
command: ["sleep", "infinity"]), make it depend on the original service, and give it the healthcheck instead, reaching the original service by its name. Make the job (and anything else that waits) depend on the probe withcondition: service_healthy, since the original service has no healthcheck and allmyram refuses waiting for it to be healthy. The probe's owndepends_onis what brings the original service into the run; without it, nothing starts the service and the probe never passes. - If allmyram refuses a field, or you need a value that differs on the
runner, redefine it in
compose.allmyram.yaml. Compose's!resetdrops a field, such asuser: !reset null. - If your Compose files are named or placed differently, add
--compose-file FILEfor each, in order.COMPOSE_FILEin your environment works too; in.envit doesn't, as in nerdctl. - If the job's service has another name, add
--service NAME. -
If you want a cache volume kept between jobs, make it a pad on the top-level volume and mount it on the
jobservice (see Keep caches between jobs): -
If two services listen on the same port, change one: every container shares one localhost. allmyram refuses ports the services declare twice.
- Services share the job's
--cpusand--memory, so raise them to cover everything. - If the image has an entrypoint you don't want the command to run
through, set
entrypoint: []on thejobservice.
--image, --entrypoint, --env, --workdir, --pad and --global-pad
apply on top of the job service. If the repo has Compose files but no
job service, --image runs your command alone and says so.
Every service in the files needs image: or build:, as in nerdctl and
Docker, and every service the job runs, the job service included, needs
image:, since allmyram doesn't build images. A service with only
build:, or a provider: service with neither, is fine as long as the
job doesn't depend on it. The Compose
files, and any file they read, must be inside the repo.
While services start¶
Nothing more prints until the job's own command starts. Meanwhile
allmyram status shows the state WaitingForServices and, in
waiting_for, the services still being waited for. Ctrl-C and
allmyram cancel work as usual, and the time limit is already counting.
If a service exits, or fails its healthcheck retries times, the run ends
with exit status 125, and the message names the service with the last
check's output and the end of the service's log.
Follow a run again¶
If the laptop sleeps or loses its network, run reconnects and carries on
where it left off. If the client was killed, the run keeps going; follow it
again with its run ID:
To check a run without following it:
Stop a run¶
Press Ctrl-C in run or attach. allmyram cancels the run and waits for
the runner to confirm; press it again to stop waiting. From another
terminal:
Keep caches between jobs¶
If a job spends its time downloading dependencies or rebuilding, give it scratch pads. A pad is a directory the runner keeps between jobs. Linux runners have them; a Mac runner refuses jobs that ask for pads.
allmyram run --runner smaug --image docker.io/library/rust:1.91.0-slim \
--pad target:/work/target --global-pad cargo-home:/cache/cargo \
--env CARGO_TARGET_DIR=/work/target --env CARGO_HOME=/cache/cargo \
-- cargo test
- Use
--padfor caches that belong to this repo, like a build directory. A branch starts from its own latest version; a new branch starts from the repo's most recently written branch. - Use
--global-padfor caches every repo on the runner can share, like a package registry. - If a cache has gone bad, add
:freshto start it empty once. - If a job should read a cache without changing it, add
:ro. - If you want a warning when a cache grows past a size, add
:max=SIZE.
allmyram status shows what became of each pad. A run that was cancelled,
failed to start, ended before its job's own container started (while it
waited for its services, say), lost its sandbox, or was cut off by a runner
restart publishes nothing. How allmyram runs
explains how pads are cloned and published.
Use the GPU (beta)¶
On a runner with a GPU, add --gpu. Only the
job's own container gets the GPU.