Skip to content

Ofelia does not parse labels from stopped containers; need job-run for one-off runs #412

@nekrich

Description

@nekrich

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)

  1. 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.

  2. job-run labels are only available on the service container
    Today, job-run can 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-run to 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions