1

I have a number of Docker based microservices which all need to talk to each other. They use container names to talk to each other. Thus, when I run this with Docker Swarm or Kubernetes (w Flannel), they rely on the Docker DNS to resolve container names into IP addresses.

Now, I'm trying to run this same set of microservices with Mesos+Marathon, but I've encountered an issue. When I launch all the microservices (using the Marathon app.App API), mesos gives them a name of "mesos-some_long_hash". I can see this name when I type "docker ps" on the machine the containers are launched in. Thus, the microserves cannot find each other due to these mesos assigned container names.

As an experiment, I forced the container names (using 'parameters' under the Marathon app.appContainer.DockerContainer API) to the names I need. The microservices work, but Marathon gets confused because it expects these "mesos-some_long_hash" names. It reports them as stuck at deploying.

I need some way to tell mesos via the Marathon APIs that I don't want a name of "mesos-some_long_hash" and instead to use a name of my choosing (the service name). I don't see anything obvious to do this in the Marathon apps API.

Anyone know how to do this?

EDIT: I just found this about the containerizer in mesos. http://mesos.apache.org/documentation/latest/docker-containerizer/

It's kind of sounding like it's not possible to change the container name? This is terrible! How does anyone do a microservice architecture if they can't name their containers without having mesos/marathon freakout?

js84
  • 3,676
  • 2
  • 19
  • 23
Andi Jay
  • 5,882
  • 13
  • 51
  • 61

2 Answers2

1

Figured out a solution.

Since I'm running Docker containers on my own "USER" network, and thus relying on the Docker DNS services. I can create aliases in the Docker DNS service with the --network-alias parameter in the docker run command. I put my service names in there and things start working again. Even with the various 'mesos-uuid' names to the containers.

Basically add a key value pair under app.appContainer.DockerContainer.parameter where the key is 'network-alias' and the value is the service name.

Looks like I can also try Mesos-DNS as well.

Andi Jay
  • 5,882
  • 13
  • 51
  • 61
0

You cant name a container in Mesos


How does anyone do a microservice architecture if they can't name their containers without having mesos/marathon freakout?

When you start a microservice architecture you should think about your containers more as cattle then pets. Just like with your servers (see this answer and that blog post). Containers could start and stop at anytime at anyplace (one of your Mesos Agents) you can't give them names because then two containers could not be started on one server.

janisz
  • 6,292
  • 4
  • 37
  • 70
  • 1
    Agree, and then you can use some tool such as [Mesos-DNS](https://github.com/mesosphere/mesos-dns) – js84 Oct 29 '17 at 21:31