问题
I have a dockerized spring-boot app, which needs to be scheduled in mesos / chronos (DC/OS). There are 2 places, which (I think) can be used to accomplish Chronos scheduling:
1) by using the "command" tag 2) by using the "container" tag
An example of Chronos command tag would be:
{
"name": "my-dockerized-app",
"command": "docker login -u my_username -p my_password -e dev-my_user@my_company.com;docker run -e id=123 my_owner/my_dockerized_app_image:latest",
"shell": true,
"epsilon": "PT60S",
"executor": "",
"executorFlags": "",
"retries": 2,
"owner": "",
"ownerName": "",
"description": "",
"async": false,
"successCount": 0,
"errorCount": 264,
"lastSuccess": "",
"lastError": "",
"cpus": 0.5,
"disk": 256.0,
"mem": 512.0,
"disabled": false,
"softError": false,
"dataProcessingJobType": false,
"errorsSinceLastSuccess": 264,
"uris": [],
"environmentVariables": [{
"name": "id",
"value": "1"
}],
"arguments": [],
"highPriority": false,
"runAsUser": "root",
"constraints": [],
"schedule": "R/2016-11-21T05:06:00.000Z/PT2M",
"scheduleTimeZone": ""
}
An example of Chronos "container" tag:
{
"schedule": "R\/2014-09-25T17:22:00Z\/PT2M",
"name": "my_docker_job",
"container": {
"type": "DOCKER",
"image": "my_owner/my_dockerized_app",
"network": "BRIDGE"
},
"cpus": "0.5",
"mem": "512",
"uris": [],
""
}
Which of these scheduling methods should really be used in Mesos / Chronos production environments?
回答1:
You should use second option
The difference in this two configurations is the way Mesos will interact with docker.
- you are creating Mesos task that is launching docker so Mesos doesn't know about docker and you need to monitor it.
- Mesos will launch docker for you and keep a track of it. So if docker fails Mesos will notify Chronos.
来源:https://stackoverflow.com/questions/40727972/what-is-a-better-way-to-run-docker-under-chronos