Uploaded image for project: 'Mesos'
  1. Mesos
  2. MESOS-3377

mesos docker container with container_name as ENV variable

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 0.25.0
    • 0.25.0
    • docker
    • None

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            sielaq Wojciech Sielski
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: