[ https://issues.apache.org/jira/browse/MESOS-3688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14959023#comment-14959023 ]
Raffaele Di Fazio commented on MESOS-3688: ------------------------------------------ We started hacking on this issue, this is what we did: 1) modified the protobuf: {quote} diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto index f2ea4fc..8a14825 100644 --- a/include/mesos/mesos.proto +++ b/include/mesos/mesos.proto @@ -1476,6 +1476,7 @@ message ContainerInfo { message ContainerStatus { // This field can be reliably used to identify the container IP address. repeated NetworkInfo network_infos = 1; + optional ContainerID id = 2; } {quote} 2) Modified the code of slave.cpp: {quote} diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp index 6526976..ea4b704 100644 --- a/src/slave/slave.cpp +++ b/src/slave/slave.cpp @@ -2859,6 +2859,12 @@ void Slave::statusUpdate(StatusUpdate update, const UPID& pid) networkInfo->set_ip_address(stringify(self().address.ip)); } + ContainerID* containerID = new ContainerID(); + containerID->set_value("PLACEHOLDER"); + containerStatus->set_allocated_id(containerID); + + TaskStatus status = update.status(); Executor* executor = framework->getExecutor(status.task_id()); {quote} We currently don't know where to retrieve the data to set in containerID. We are looking into the mesos source code, but we would appreciate any suggestion and/or explanation of some mesos internals. We know this is just an hack and probably not a good enough solution, but it should be something similar. Can anyone help us making it better? > Get Container Name information when launching a container task > -------------------------------------------------------------- > > Key: MESOS-3688 > URL: https://issues.apache.org/jira/browse/MESOS-3688 > Project: Mesos > Issue Type: Improvement > Components: containerization > Affects Versions: 0.24.1 > Reporter: Raffaele Di Fazio > Labels: mesosphere > > We want to get the Docker Name (or Docker ID, or both) when launching a > container task with mesos. The container name is generated by mesos itself > (i.e. mesos-77e5fde6-83e7-4618-a2dd-d5b10f2b4d25, obtained with "docker ps") > and it would be nice to expose this information to frameworks so that this > information can be used, for example by Marathon to give this information to > users via a REST API. > To go a bit in depth with our use case, we have files created by fluentd > logdriver that are named with Docker Name or Docker ID (full or short) and we > need a mapping for the users of the REST API and thus the first step is to > make this information available from mesos. -- This message was sent by Atlassian JIRA (v6.3.4#6332)