gpt4 book ai didi

docker - 将 Ubuntu Docker 容器作为 Marathon 应用程序运行不断重启

转载 作者:行者123 更新时间:2023-12-04 19:11:40 26 4
gpt4 key购买 nike

嗨,我正在尝试在马拉松应用程序中运行 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 容器并使其在后台运行?

最佳答案

试试下面的马拉松配置:

{
"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"

关于docker - 将 Ubuntu Docker 容器作为 Marathon 应用程序运行不断重启,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53447718/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com