Hi I'm trying to run ubuntu docker inside a marathon app and this is my service configuration:
{
"id": "/h",
"backoffFactor": 1.15,
"backoffSeconds": 1,
"container": {
"type": "DOCKER",
"volumes": [],
"docker": {
"image": "ubuntu",
"forcePullImage": false,
"privileged": true,
"parameters": [{
"key": "detach",
"value": "true"
},
{
"key": "tty",
"value": "true"
},
{
"key": "interactive",
"value": "true"
}
]
}
},
"cpus": 1,
"disk": 10000,
"instances": 0,
"maxLaunchDelaySeconds": 3600,
"mem": 1028,
"gpus": 0,
"networks": [{
"mode": "host"
}],
"portDefinitions": [],
"requirePorts": false,
"upgradeStrategy": {
"maximumOverCapacity": 1,
"minimumHealthCapacity": 1
},
"killSelection": "YOUNGEST_FIRST",
"unreachableStrategy": {
"inactiveAfterSeconds": 0,
"expungeAfterSeconds": 0
},
"healthChecks": [],
"fetch": [],
"constraints": []
}
I try to set --detach and --tty
options to run ubuntu container in the background and keep it alive and one more thing i tried is "cmd": "-sleep 1000000000"
but just after starting, task keeps finishing and starting another task in less than one second!
How can I start docker container and keep it running in the background?
Try below marathon config :
{
"id": "/test-ubuntu",
"backoffFactor": 1.15,
"backoffSeconds": 1,
"cmd": "tail -f /dev/null",
"container": {
"type": "DOCKER",
"volumes": [],
"docker": {
"image": "ubuntu",
"forcePullImage": false,
"privileged": true,
"parameters": []
}
},
"cpus": 1,
"disk": 10000,
"instances": 1,
"maxLaunchDelaySeconds": 3600,
"mem": 1028,
"gpus": 0,
"networks": [
{
"mode": "host"
}
],
"portDefinitions": [],
"requirePorts": false,
"upgradeStrategy": {
"maximumOverCapacity": 1,
"minimumHealthCapacity": 1
},
"killSelection": "YOUNGEST_FIRST",
"unreachableStrategy": {
"inactiveAfterSeconds": 0,
"expungeAfterSeconds": 0
},
"healthChecks": [],
"fetch": [],
"constraints": []
}
Docker container requires entrypoint which will run in foreground. Try below cmd :
"cmd": "tail -f /dev/null"