0

I have a very simple container which says "hello world"

I have successfully run them and scale them to X.

They all seem to be in a cycle where they would run it then sleep for a bit then run it again.

Marathon cycle would be: Waiting, Running, Delayed and repeat
Swarm cycle woulbd be: Ready, Running, Shutdown and repeat

How do i specify so that the container finishes after first execution whether in swarm or marathon?

ealeon
  • 12,074
  • 24
  • 92
  • 173

1 Answers1

0

You can not, both Swarm and Marathon are designed for long running services.

For running something just one time you should use plain docker run command in Swarm and some other framework in Mesos (Marathon run on Mesos) e.g. Chronos which is cron replacement for Mesos and runs tasks periodically.

Mateusz Moneta
  • 1,500
  • 1
  • 10
  • 7
  • I want to use mesos load balancing via marathon framework so i want to run stuff through marathon but short-lived containers – ealeon Aug 26 '16 at 01:11
  • https://docs.docker.com/swarm/install-manual/#/step-6-communicate-with-the-swarm as for Marathon you can use Mesos DNS with srv recors: https://mesosphere.github.io/mesos-dns/docs/naming.html – Mateusz Moneta Aug 26 '16 at 05:01
  • first one is about `docker run` in swarm and second about alternative for loadbalancer: mesos dns – Mateusz Moneta Aug 26 '16 at 06:20
  • i've started docker swarm cluster with the command: docker swarm so that doesnt work for me. and I would like to use mesos through marathon (the whole point of container orchestration, right?) maybe it just doesnt fit my need – ealeon Aug 26 '16 at 06:45
  • As I wrote earlier Marathon is designed to long running tasks so you try to do something against it very purpose. AFAIK `docker swarm` command is just shortcut and you still should be able to run regular commands. – Mateusz Moneta Aug 26 '16 at 07:13