[ https://issues.apache.org/jira/browse/MESOS-3377?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14732461#comment-14732461 ]
haosdent commented on MESOS-3377: --------------------------------- {code} mesos doesn't use local docker binary {code} slave have this flag "--docker=" to specify the location of docker binary, is this one meet your need? If not, I think just add one line and then could get the container name from env {code} iff --git a/src/docker/docker.cpp b/src/docker/docker.cpp index ec2de54..7ad9a74 100755 --- a/src/docker/docker.cpp +++ b/src/docker/docker.cpp @@ -411,6 +411,7 @@ Future<Nothing> Docker::run( argv.push_back("-e"); argv.push_back("MESOS_SANDBOX=" + mappedDirectory); + argv.push_back("CONTAINER_NAME=" + name); foreach (const Volume& volume, containerInfo.volumes()) { string volumeConfig = volume.container_path(); {code} > mesos docker container with container_name as ENV variable > ---------------------------------------------------------- > > Key: MESOS-3377 > URL: https://issues.apache.org/jira/browse/MESOS-3377 > Project: Mesos > Issue Type: Wish > Components: docker > Affects Versions: 0.25.0 > Reporter: Wojciech Sielski > Priority: Minor > > 1. Long story short: > We have mesos and marathon (and other app) based PaaS. > https://github.com/eBayClassifiedsGroup/PanteraS > We use mesos with consul and registrator as a glue app that register in > consul docker containers.. Some tricky part we have with deregistering > container BEFORE it is killed, but after SIGTERM is received. > To do that we use bash wrapper script that trap SIGTERM > https://github.com/eBayClassifiedsGroup/PanteraS/blob/master/frameworks/start.sh#L45 > and put container into consul maintenance mode. > Till that part everything works perfectly fine - so when marathon re-deploy > container it is smoothly taken out from consul (and loadbalancers) > To take service out from consul, we need to know consul service id = which is > based on mesos container name (this is how registrator do that). > We did kind of easy docker wrapper that inject mesos name as ENV variable: > https://github.com/eBayClassifiedsGroup/PanteraS/blob/master/infrastructure/docker > BUT > Since new mesos release, mesos doesn't use local docker binary, but docker > socket and API. So our workaround will not work anymore. > 2. What we need - our wish :) : > Just injection of docker mesos name as ENV variable. > Since this is the easiest way of getting it, so we can easy deregister it. > ps. > Yes, we know that you can do docker inspect to get that - but this require > docker application - in smallest container we cannot have it. > Yes, we know that you can get it from docker API (same like inspect) > but much much easier is 12 factor app rule to follow and have it as ENV > variable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)