Skip to content

Prevent container from 'executing' outside schedule #403

@kimbamps

Description

@kimbamps

Description

Problem situation

We have containers that run like a jobs for which we use this awesome scheduling solution. During deploy of a new container version or when they get a scheduled cron trigger, the container starts running and does its thing, which is great.

But when a container gets restarted manually, a host machine is rebooted, Docker Swarm labels are changed, ... this container service also start executing. Which normal behavior for a container, but we don't want that in our case, since it is generating to much unwanted load.

Before using this scheduling solution we made use of a container command to start the internal execution of the container. By default the container would start but would do nothing and end up in the completed state. Only when we provided a start command to the container he would execute the job in the container.

Request

Would it be possible to add extra label swarm.cronjob.container-command to provide a command to the scheduled container.

Possible implementation

I'm assuming you probably trigger a docker service update at schedule time? (I did have a look at the code, but GO really isn't my language ;))
But if my assumption is correct, you could possibly use the docker service update --args "<container-command>" <serviceName> command to facilitate this.

What are your thoughts on this? Or does anybody have other possible solutions for this problem?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions