-
Notifications
You must be signed in to change notification settings - Fork 204
Description
Ofelia does not parse labels from stopped containers; need job-run for one-off runs
I want to do a scheduled job-run for a stopped container w/o the need to configure the Ofelia in any way.
Problem(s)
-
Stopped containers are ignored
Ofelia only reads labels from running containers. If a container is stopped (e.g. a one-off or maintenance container), its labels are never considered, so jobs cannot be configured from them. -
job-run labels are only available on the service container
Today,job-runcan only be defined on the Ofelia service container or in the config file. There is no way to define a run job with labels in a non-service container.
Use case
I need to run one-time containers (e.g. backups, configs sync) using job-run, where the job is configured via Docker labels on a container that may be stopped. job-exec is out of scope, since I just need to start the container and idk what command is used there. Typical flow:
- A container exists (possibly stopped) with ofelia labels defining a run job.
- Ofelia should parse those labels and run the job (starting the container if needed).
It's impossible because labels from stopped containers are never read, and run jobs from non-service containers are not supported.
Proposed behavior
- Parse labels from all matching containers, including stopped ones.
- Allow
job-runto be defined on any container (not only the ofelia service container), with the container name used as the run target. - Restrict other job types on stopped containers so that only job-run is allowed there; exec/local/service-run labels can remain only for running-container or service-container only.
With this proposal, services can be configured entirely via labels on the containers themselves. There is no need to change ofelia’s config or restart ofelia when adding or updating jobs — ofelia picks up label changes automatically.