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 shows wrong ports in task view #2987

Closed hotstepper13 closed 8 years ago

hotstepper13 commented 8 years ago

I defined in my marathon configuration:

"ports": [
    61616,
    8161
],

because i exactly want/need this ports.

In the marathon ui "Task" view i got 192.168.134.161:[31327, 31328]

While in the "Config" view i got Ports 61616, 8161

So it seems that there are random ports assigned even if I dont define $PORT0 within the whole json file. Maybe it is only a usage error but I would like to be sure.

Here is the complete config:

{ "id": "/somecustomer/activemq", "cmd": "docker stop activemq; docker rm activemq ; docker pull our.repository.tld/common/activemq:latest ; docker run -m 512m --rm --name activemq -p 61616:61616 -p 8161:8161 our.repository.tld/common/activemq:latest", "cpus": 0.3, "mem": 512.0, "ports": [ 61616, 8161 ], "requirePorts": false, "instances": 1, "executor": "", "constraints": [ ["hostname", "UNIQUE"] ] }

kolloch commented 8 years ago

Hello @hotstepper13, please make sure that you read about ports in our documentation.

The ports returned in the AppDefinition are "service ports" or "app ports". See https://mesosphere.github.io/marathon/docs/service-discovery-load-balancing.html#service-ports-assignment

If you require your tasks to run on specific ports, you do need to specify "requirePorts: true". It is easy to do wrong, so checkout https://mesosphere.github.io/marathon/docs/troubleshooting.html#requiring-a-specific-host-port as well.

hotstepper13 commented 8 years ago

Ahhh.. i see... i found or set the "hostPort" to non-zero in the docker "portMappings"

in the docs, but havent read the troubleshooting before. Maybe a hint regarding the limitation of ports to be used within the "portMappings" would be a great enhancement.

It is up to you if you take this as request for documentation enhancement :)

kolloch commented 8 years ago

@hotstepper13 good that I could help you.

Please feel very free to provide improvements to the documentation as PR. See https://mesosphere.github.io/marathon/docs/contributing.html