【问题标题】:Running Ubuntu Docker container as a Marathon App keeps restarting将 Ubuntu Docker 容器作为 Marathon 应用程序运行不断重启
【发布时间】:2018-11-23 13:35:27
【问题描述】:

您好,我正在尝试在马拉松应用程序中运行 ubuntu docker,这是我的服务配置:

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

}

我尝试设置 --detach 和 --tty 选项以在后台运行 ubuntu 容器并使其保持活动状态,我尝试的另一件事是 "cmd": "-sleep 1000000000" 但刚开始后,任务不断完成并在更少的时间内开始另一个任务超过一秒! 如何启动 docker 容器并使其在后台运行?

【问题讨论】:

    标签: docker ubuntu containers mesos marathon


    【解决方案1】:

    试试下面的马拉松配置:

    {
      "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 容器需要在前台运行的入口点。 试试下面的cmd:

        "cmd": "tail -f /dev/null"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-04-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-24
      • 2023-02-11
      • 2022-01-13
      相关资源
      最近更新 更多