mirror of
https://github.com/docker/compose.git
synced 2026-11-20 15:09:50 +00:00
`docker compose run <job>` triggers a run of the job on the engine, starts its dependencies first, streams its logs and returns its exit code like a one-off service; a job accepts manual triggering unless it declares manual: false. A scheduled job runs as up registered it: an override, or a job up never registered, is refused. A manual job is removed from the engine after its run, so the next run can differ. When the engine cannot run jobs, run falls back to a one-off service with a warning. --detach is refused, an interrupted run is cancelled, a dry run only reports it. A job named by create, start, build, pull or push gets an error naming run instead. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
33 lines
646 B
YAML
33 lines
646 B
YAML
services:
|
|
db:
|
|
image: alpine
|
|
init: true
|
|
command: sleep infinity
|
|
jobs:
|
|
migrate:
|
|
image: alpine
|
|
command: sh -c 'echo "migration done"'
|
|
# run is invoked twice below and must build the identical spec hash each time
|
|
environment:
|
|
A: "1"
|
|
B: "2"
|
|
C: "3"
|
|
D: "4"
|
|
triggers:
|
|
manual: true
|
|
depends_on:
|
|
db:
|
|
condition: service_started
|
|
backup:
|
|
image: alpine
|
|
command: echo backup
|
|
triggers:
|
|
schedule:
|
|
- cron: "0 3 * * *"
|
|
rotation:
|
|
image: alpine
|
|
command: echo rotation
|
|
triggers:
|
|
manual: false
|
|
schedule:
|
|
- cron: "0 3 1 * *"
|