For years, a Compose file described the services that make up an application: a database, an API, a cache, a worker, and the network connecting them. Backups, cleanup tasks, and scheduled maintenance usually lived somewhere else: a cron container, a host timer, a CI workflow, or a separate scheduler.

Docker Compose 5.8.0, released on November 17, adds a top-level jobs model for one-shot and scheduled workloads. The feature is interesting, but the compatibility requirements are easy to miss: scheduling is experimental and requires Docker Engine 29.10.0 or later with the jobs extension explicitly enabled.

The release also appeared at number 13 in the Go weekly GitHub Trending list for November 23, with 752 stars gained in that weekly snapshot. That is a dated attention signal; the practical reason to read the release is the new workload model.

Services and jobs solve different problems

A service is expected to remain available or restart when it exits. A job is expected to do a unit of work and finish. Examples include:

  • dumping a database,
  • running a manual migration,
  • generating a report,
  • pruning old artifacts,
  • performing a periodic integrity check.

Compose 5.8.0 introduces a top-level jobs section alongside services. A job can be manually triggered or scheduled with a cron expression. The Docker Engine extension owns the schedule and records execution state and exit code; Compose registers the declaration with the engine.

That distinction matters. The scheduler is not a background loop inside the Compose CLI process. Once registered, the engine is responsible for firing the job.

Requirements before you try it

The official Docker jobs guide lists these prerequisites:

  • Docker Compose 5.8.0 or later.
  • Docker Engine 29.10.0 or later.
  • The Engine jobs extension enabled.

The extension is off by default. On a Linux Docker Engine host, add this to the daemon configuration:

{ "extensions": { "enable": ["org.mobyproject.jobs.v0"] } } 

Restart the daemon after changing its configuration. The exact restart command depends on how Docker Engine is installed, so use the service manager for your host rather than blindly copying a systemd command onto Docker Desktop.

Check your versions before creating the project:

docker version docker compose version 

If a project declares scheduled jobs while the extension is disabled, Compose refuses the project during up/create/start instead of silently pretending the schedule is active. A manual job can still run as a one-off service on an engine without the extension, but it will not be registered for scheduling.

A nightly PostgreSQL backup

Here is a small example adapted from Docker's official quickstart. It runs a PostgreSQL database and declares a backup job that writes timestamped dumps into a local directory.

name: jobs-demo x-db-env: &db-env DB_URL: postgresql://postgres:demo@db/shop services: db: image: postgres:16-alpine environment: POSTGRES_PASSWORD: demo POSTGRES_DB: shop healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres -d shop"] interval: 2s timeout: 3s retries: 15 jobs: backup: image: postgres:16-alpine environment: *db-env volumes: - ./backups:/backups command: - sh - -c - | until pg_isready -q -d "$$DB_URL"; do sleep 1; done pg_dump --no-owner -f /backups/shop-$$(date +%H%M%S).sql "$$DB_URL" triggers: schedule: - cron: "0 3 * * *" timezone: Asia/Kolkata 

Create the output directory, then register the project:

mkdir -p backups docker compose up -d 

This schedules the job for 03:00 Asia/Kolkata. If you omit timezone, Docker Engine evaluates the cron expression in UTC. The default missed_fires setting is one, so an overdue schedule can trigger a single catch-up run after the daemon restarts.

To run the job immediately and see its logs:

docker compose run backup 

The job starts its dependencies, streams the output, and returns the job's exit code. When you remove the project with docker compose down, Compose removes its registered scheduled jobs as well.

Do not use the sample password or local bind mount as a production backup strategy. Use a secret manager, a remote destination, retention rules, encryption, and restore tests before trusting a scheduled dump.

Important boundaries and limitations

The new feature is marked Experimental. Docker's documentation warns that the syntax and behavior may change between releases. Treat it as something to evaluate in a non-critical environment first.

There is also an important dependency direction: a job can depend on a service, but a service cannot wait for a job through depends_on. If your application must wait for a database migration before it starts, use an init container or another migration orchestration pattern. A scheduled job is not a replacement for a startup dependency graph.

Jobs are for finite work. If a process should keep running and be restarted when it exits, model it as a service. If you need a portable scheduler across Kubernetes clusters, a Kubernetes CronJob may still be a better fit. If your task belongs to a source repository rather than a deployed stack, a scheduled GitHub Actions workflow may be simpler. On a single Linux host, systemd timers remain a mature alternative.

Should you adopt it now?

Use Compose jobs when the workload belongs to the same local or self-hosted stack as the services it operates on, and you are comfortable enabling an experimental Engine extension.

Wait if you need stable scheduling semantics, strict platform portability, or a migration that must block application startup. The new model is attractive because it keeps service and maintenance definitions together, but it does not eliminate the need for backup verification, monitoring, secrets management, or operational runbooks.

The best first experiment is a harmless report job that writes a timestamp and exits. Verify registration, manual execution, scheduled execution, failure reporting, and cleanup before moving a real backup into the scheduler.

Would you keep recurring maintenance tasks beside your services in Compose, or do you prefer a separate scheduler with an independent failure boundary?

Sources and further reading

About the author: GitHub · LinkedIn · YouTube