introduce Jobs - #642
Open
ndeloof wants to merge 3 commits into
Open
introduce Jobs#642ndeloof wants to merge 3 commits into
ndeloof wants to merge 3 commits into
Conversation
Collaborator
Author
|
cc @JulienBreux |
Contributor
|
Very good, how can I help 🤗 |
Contributor
|
@JulienBreux you’ll need to wait a little bit, this PR is only a draft for now. We still have some internal design work to finish first, as this needs to be supported on the Engine and CLI sides as well 😉 But we’re working on it 🎉 |
Contributor
Thanks! Brilliant! That's a really good news. |
ndeloof
force-pushed
the
jobs
branch
6 times, most recently
from
July 31, 2026 06:40
142c286 to
f0b1c1a
Compare
Add the jobs top-level element for run-to-completion containers, and extract the container configuration shared across element types as a layered specification: - container_spec: attributes of a single container, shared by anything that runs one — services, jobs, and pre_start init containers - workload_spec: orchestrated-workload attributes (build, depends_on, expose, healthcheck, ports, stdin_open, tty), shared by services and jobs - service-only attributes (attach, container_name, restart, scale, deploy, develop, extends, links, external_links, provider, lifecycle hooks) stay in the services document pre_start hooks become a full container specification (allOf [container_spec] + per_replica) instead of a hand-curated 7-attribute subset: undeclared attributes are inherited from the service, declared ones override with the merge-file rules (compose-spec#656). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
manual defaults to true — any job can be executed by an explicit run command; an explicit false forbids it, for scheduled jobs whose out-of-schedule execution would be harmful. manual and schedule may now be combined (anyOf instead of an exclusive oneOf). Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
The spec-build stage introduced by "introduce Jobs" cats jobs.md and container_spec.md into spec.md but forgot workload_spec.md, so build, depends_on, expose, healthcheck, ports, stdin_open and tty silently dropped out of the generated single-file spec. Add the missing cat and regenerate spec.md accordingly. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
aevesdocker
approved these changes
Sep 29, 2026
aevesdocker
left a comment
Contributor
There was a problem hiding this comment.
Looks good for the release. There are a few 'AI-isms' but I can see to that in a follow-up after the release lands ( + then get it onto the docs site)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
Introduce jobs top-level element and a layered container specification
Motivation
Services are long-running processes, but Compose users also need to define one-shot tasks — database migrations, batch processing, scheduled cleanups. A common hack is to declare those as "services" with a profile so they are excluded by default, and invoke them with
docker compose run.This PR introduces jobs as a first-class top-level element in the Compose specification to address this gap.
To avoid duplicating the full container configuration schema between element types, the shared configuration is extracted as a layered specification:
container_spec— the attributes of a single container, shared by anything that runs one: services, jobs, and run-to-completion init containers (pre_starthooks);workload_spec— orchestrated-workload attributes (build,depends_on,expose,healthcheck,ports,stdin_open,tty), shared by services and jobs;attach,container_name,restart,scale,deploy,develop, lifecycle hooks, …) stay in the services document.As a direct consequence,
pre_starthooks become a full container specification (allOf [container_spec]+per_replica) instead of a hand-curated 7-attribute subset: undeclared attributes are inherited from the service, declared ones override with the merge-file rules — the direction proposed in #656. Attributes excluded from inheritance by that proposal (ports,healthcheck,depends_on,build, …) are excluded by construction: they live inworkload_spec, which hooks do not compose.Note: this requires JSON Schema draft 2020-12 as proposed on compose-spec/compose-go#864 so we can use
unevaluatedPropertiesfor composition byallOf/$refWhich issue(s) this PR fixes:
Fixes #92
Addresses #656 (schema side)