mesosphere / marathon

Deploy and manage containers (including Docker) on top of Apache Mesos at scale.
https://mesosphere.github.io/marathon/
Apache License 2.0
4.07k stars 845 forks source link

Marathon does not stop the launched app #3987

Closed mendrugory closed 8 years ago

mendrugory commented 8 years ago

Hi,

I am using Marathon to launch my docker containers through the rest API. I am using Mesos-DNS as service discovery and in order to let it know to the docker container I am launching the container using the command in order to be able to use the --dns option. (Is there any way of adding a DNS to a docker container using the container option of Marathon?)

curl -XPOST 'http://my_marathon:8080/v2/apps' -H 'Content-Type: application/json' -d '{ "id": "my_app", "cmd": "docker run --rm --dns DNS my_app", "cpus": 1, "mem": 256, "instances": 4 }'

When I try to stop the app using the Marathon UI, the 4 instances of my app are still running on the slaves although they don't appear in Marathon anymore.

mendrugory commented 8 years ago

I faced this problem because I was launching a docker container using the command option in order to add it a DNS. I have found a workaround in order to avoid this problem:

curl -XPOST 'http://my_marathon/v2/apps' -H 'Content-Type: application/json' -d '{ "id": "my_app", "container": { "docker": { "image": "my_app", "network": "BRIDGE", "parameters": [ { "key": "dns", "value": "DNS_IP" } ] }, "type": "DOCKER" }, "cpus": 1, "mem": 256, "instances": 4 }'

If the container is launched like that, it works like a charm.

jasongilanfarr commented 8 years ago

Docker is natively supported using the container construct and should generally not be run through the "cmd" style.