本文介绍了在chronos下运行docker的更好方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个dockerized的spring-boot应用程序,需要在mesos/chronos(DC/OS)中进行计划.有2个地方(我认为)可用于完成Chronos调度:

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)使用命令"标签2)使用容器"标签

1) by using the "command" tag2) by using the "container" tag

Chronos命令标签的示例为:

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": ""
}

Chronos容器"标签的示例:

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": [],
     ""
    }

Mesos/Chronos生产环境中应该真正使用哪些调度方法?

Which of these scheduling methods should really be used in Mesos / Chronos production environments?

推荐答案

您应使用第二个选项

这两种配置的区别在于Mesos与docker交互的方式.

The difference in this two configurations is the way Mesos will interact with docker.

  1. 您正在创建启动docker的Mesos任务,因此Mesos不了解docker,因此您需要对其进行监视.
  2. Mesos将为您启动docker并对其进行跟踪.因此,如果docker失败,Mesos将通知Chronos.

这篇关于在chronos下运行docker的更好方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-09 15:59