运行ubuntudocker容器作为一个马拉松应用程序不断重启

5lwkijsr  于 2021-06-26  发布在  Mesos
关注(0)|答案(1)|浏览(508)

嗨,我正在马拉松应用程序中运行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": []

}
我试着把…分开 --tty 在后台运行ubuntu容器并使其保持活动状态的选项,还有一件事我尝试了 "cmd": "-sleep 1000000000"  但是 刚开始,任务就一直在完成,不到一秒钟就开始了另一个任务!如何启动docker容器并使其在后台运行?

zpgglvta

zpgglvta1#

尝试以下配置:

{
  "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": "tail -f /dev/null"

相关问题