The following command can be used to construct a simple Marathon application definition:
$ kv \
id python-server \
cmd 'python3 -m http.server 8080' \
cpus 0.1 \
mem 64 \
instances 1 \
container "$(kv \
type DOCKER \
docker "$(kv image python:3)" \
portMappings "$(list \
"$(kv containerPort 8080 hostPort 0)" \
)" \
)" |
jq . # kv/list/etc. compact output -- pretty print this
This produces the following output (including the pretty-printing above):
{
"id": "python-server",
"cmd": "python3 -m http.server 8080",
"cpus": 0.1,
"mem": 64,
"instances": 1,
"container": {
"type": "DOCKER",
"docker": {
"image": "python:3"
},
"portMappings": [
{
"containerPort": 8080,
"hostPort": 0
}
]
}
}