How to find docker container for a marathon/mesos task?

717 views
Skip to first unread message

Shawn

unread,
Oct 17, 2014, 12:16:10 AM10/17/14
to marathon-...@googlegroups.com
Hi,

I'm using marathon 0.7.1 and mesos 0.20.1 and wonder if there is an easy way to find the docker container corresponding to a marathon/mesos task.

For example, I have a marathon/mesos task with:
14289057.eqgnljispyocvub.73d085b8-4f70-11e4-aa42-80e65019b21a.77b72491-4f70-11e4-a754-56847afe9799

and its docker container has name:

mesos-7c6a7c9a-d5e6-40e8-84b5-17bbb15c93fe

There is no obvious pattern how the name of docker container can be related to the id of the marathon/mesos task. I inferred it from port number: both point to the same host port.

Is there any better of doing such mapping?

Thanks!

Shawn

Michael Babineau

unread,
Oct 17, 2014, 12:47:03 PM10/17/14
to Shawn, marathon-framework
This isn't much better, but you could parse it from the logs:

# grep 955fb8b3-38e4-40a3-bb61-578a9a219bbf /var/log/mesos/mesos-slave.INFO 
I1016 23:45:49.154315  1527 docker.cpp:743] Starting container '955fb8b3-38e4-40a3-bb61-578a9a219bbf' for task 'myapp.8e62207f-558e-11e4-9451-56847afe9799' (and executor 'myapp.8e62207f-558e-11e4-9451-56847afe9799') of framework '20140730-214326-823074732-5050-2495-0000'



--
You received this message because you are subscribed to the Google Groups "marathon-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to marathon-framew...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shawn

unread,
Oct 17, 2014, 10:33:06 PM10/17/14
to marathon-...@googlegroups.com
Should it be exposed by marathon/mesos? Any reason not to?

Don Laidlaw

unread,
Oct 18, 2014, 2:23:05 PM10/18/14
to marathon-...@googlegroups.com
I think it would be a good idea as well. Particularly at development/debugging time.

The way I have been finding the docker container is to look at the stdout in the mesos sandbox. It has the following lines near the beginning:

Registered executor on my.hostname.com
Starting task a.b.c.4a33417c-5646-11e4-8696-2abd00a84984
Forked command at 14201
/bin/sh -c exit `docker wait mesos-67ff283a-5379-491d-9177-30ab8586aed4`

The docker container name is mesos-67ff283a-5379-491d-9177-30ab8586aed4

-Don

Marc Zimmermann

unread,
Nov 25, 2014, 1:50:35 PM11/25/14
to marathon-...@googlegroups.com
Not really better but when you use the docker api you can use the "HostConfig":  "Binds": field and see which path is bind to the MESOS_PATH.
The path includes the name of the app.

For example:
 "HostConfig": {
        "Binds": [
            "/tmp/mesos/slaves/20141119-190952-58727596-5050-1358-1/frameworks/20141015-205628-58727596-5050-13860-0000/executors/marctest.bc331a33-701f-11e4-8439-56847afe9799/runs/649265fe-5774-4ef7-97ce-81c7dda6b7ec:/mnt/mesos/sandbox"
        ],

The name of the app is the part between the /excutors/ and the first .

Marc

Reply all
Reply to author
Forward
0 new messages