After marathon starts a docker task, there is no information from marathon that can be used to identify the corresponding docker container started by the task. It'd be useful if marathon can expose that information.
Would it help if Marathon set the hostname by default to the Mesos Task ID?
I'm afraid not much unless you know there is a way for marathon users to translate Mesos Task ID into docker id/name. Is there?
If you provide a hostname yourself, then you can look at task id yourself which then translates into the hostname you provided.
@tnachen
I'm confused - I need a way to map Mesos Task ID into docker container ID or container name. The use case of this is to allow me to collect metrics/logs for the containers created for a Marathon app. The metrics/logs collection currently are only supported at docker container level, that's why I need to know the IDs of docker containers created from a Marathon app.
Why can't you use taskID as container name? Why do you need to create some other ID for docker container? hostname will not help at all, because if you have 250 containers on the host, and you need to go through all of them just to get a match with one, I doubt it's a proper way to do this. The best option would be to have direct match between TaskID from marathon and container name. No over engineering with some extra IDs, no headache of matching containers to tasks, plain and simple.
Unfortunately Mesos uses the docker name for its own accounting purpose as there is no way to tag or add metadata to a particular container in Docker. Which means Mesos needs to control the docker container name, and it's not the task id. We're thinking about providing these information back as TaskStatus in the future.
Out of curiosity, what is the use case to control the container name by Mesos? what is the difference between task id and mesos container name if both values are unique?
+1; some way to correlate container name and mesos task ID would help correlate log sources e.g. using docker with syslog log-driver, the docker id is emitted along with each log statement. A way to correlate that with the mesos task would be helpful.
+1 would be useful
@onorua I think one challenge is that in mesos it's possible to run many task in a container (mesos native or docker) which means that a single taskid can't be used for the docker name.
I can't remember off the top of my head whether mesos sets the docker name to the executor id or whether it sets it to some other container id. If it's set to the executor id, that information can be used to correlate the container with the task.
For cluster type deployments, when multiple containers need to talk to each other, each container should have easy name tag and other containers should be able to identify and connect using the name of the container.
@ajaybhatnagar That's probably a larger story that exceeds the scope of this issue ;) If you do make feature suggestions, it would also help if you were more specific, elaborated on use cases, possible syntax etc. But please in a separate issue.
+1
+1
Such feature is very important for container monitoring
+1
+1
Could also add mesos/marathon labels to docker labels.
+1
+1
Note: This issue has been migrated to https://jira.mesosphere.com/browse/MARATHON-4031. For more information see https://groups.google.com/forum/#!topic/marathon-framework/khtvf-ifnp8.