what is a better way to run docker under chronos?

梦想与她 提交于 2019-12-12 04:32:39

问题


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.

  1. you are creating Mesos task that is launching docker so Mesos doesn't know about docker and you need to monitor it.
  2. 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!