0

I would like to maintain container names when recreating a docker container with Marathon.

Example: I have 2 Mesos slaves (A, B) with 6 instances of an app (3 docker containers on each slave):

On host A:
APP-1, APP-2, APP-3
On host B:
APP-4, APP-5, APP-6

I would like that:

If docker container "APP-2" fails, host A or B to spawn another docker container named: "APP-2" not "APP-a-different-uuid".

I've tried with constraints but no luck.

How can I enforce this ? Is there a way to enforce mesos/marathon to only allocate 6 instances and preserve the names no matter on which slaves they will be spawned ?

ady8531
  • 689
  • 5
  • 13
  • 24
  • Your [Marathon App definition](https://mesosphere.github.io/marathon/docs/application-basics.html) should enforce the number of instances (containers) that Marathon will launch. They will all have the application id you specify in the definition, but I'm not sure that you can control the names of the containers that the app launches. – Judith Malnick Oct 19 '17 at 00:20
  • I'm interested in consistency across the cluster. I have storage that is linked to the actual instance (for example for elasticsearch), when marathon re spawns a new instance, I want elastic to match it to the storage and recognize the data in the storage. Else elastic will drop the data. the link is done by the name of the node/instance. Moreover cluster awareness it's done based on zones which is done again by instance name. So the name of the docker/instance is very important – ady8531 Oct 19 '17 at 07:34
  • I think that Marathon can take care of this for you. See this [document](https://mesosphere.github.io/marathon/docs/persistent-volumes.html) on stateful applications. – Judith Malnick Oct 19 '17 at 22:55
  • You should be able to do cluster awareness with [mesos attributes](http://mesos.apache.org/documentation/latest/attributes-resources/). – Judith Malnick Oct 20 '17 at 00:10
  • mesos attributes are for resources not application awareness, marathon is the one handling the tasks. – ady8531 Oct 23 '17 at 13:17

0 Answers0