mesosphere/marathon — pull request #774 by gkleiman (2014-11-08 17:25:34+00:00)
Title: Expose ports in env as PORT_XX.

Make it possible to refer to declared ports by number when
starting/configuring an app.

That means that if you put the following in your app manifest:

{
[...]
"ports": [80, 443]
[...]
}

Then the env for your app will contain the following variables:

PORT_80=32185
PORT_443=32184

Port mappings are also supported, so if you put the following:

{
[...]
"container": {
"type": "DOCKER",
"docker": {
[...]
"network": "BRIDGE",
"portMappings": [
{
"containerPort": 8080,
"hostPort": 0,
"servicePort": 9000,
"protocol": "tcp"
},
{ "containerPort": 161, "hostPort": 0, "protocol": "tcp"}
]
}
}
[...]
}

Then these vars will be added to the env:

PORT_8080=32185
PORT_161=32184

Fixes #588