在marathon中作为任务运行docker容器

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

我已经在本地系统上设置了mesos和marathon。而且,我的系统上有docker引擎,当我运行时, sudo docker images ,我得到如下结果,

REPOSITORY                                                 TAG                 IMAGE ID            CREATED             SIZE
myrepo/hello                                               latest              b7ce0084dbaf        4 weeks ago         330.3 MB
fluent/new                                                 latest              adc4b7b4b0eb        4 weeks ago         1.589 GB
<none>                                                     <none>              3a87799875ed        4 weeks ago         1.589 GB
<none>                                                     <none>              16a573cd3b85        4 weeks ago         330.3 MB
769348183957.dkr.ecr.us-east-1.amazonaws.com/ruby          2.1.10              77bf121d484e        8 weeks ago         1.535 GB
769348183957.dkr.ecr.us-east-1.amazonaws.com/centos-base   7                   9ab68a0dd16a        10 weeks ago        330.3 MB
hello-world                                                latest              c54a2cc56cbb        12 weeks ago        1.848 kB
docker/whalesay                                            latest              6b362a9f73eb        16 months ago       247 MB

现在,通过marathonui,我正在尝试创建一个应用程序,在完成了文档中的所有步骤之后 https://mesosphere.github.io/marathon/docs/native-docker-private-registry.html ,当我最终创建应用程序时,它的状态在部署和间歇等待之间变化,最后显示为延迟。我从来没有在跑步阶段得到过。我试图找出我的机器上的日志,但我无法理解他们看到他们的音量。
我的应用程序json配置如下:

{
  "id": "/123",
  "cmd": "sudo docker run -itd 9ab68a0dd16a /bin/bash",
  "cpus": 1,
  "mem": 128,
  "disk": 200,
  "instances": 1,
  "container": {
    "docker": {
      "image": "769348183957.dkr.ecr.us-east-1.amazonaws.com/centos-base",
      "network": "HOST",
      "forcePullImage": true
    },
    "type": "DOCKER"
  }
}

我遗漏了什么吗?好吧,应用程序应该会自动从我的本地repo中提取这个映像,并最终部署到机器上。我是否也应该为我的应用程序创建一个任务,因为我没有专门创建任何任务?如果是,我不需要先创建一个应用程序,然后再向其中添加任务吗?
另外,我重新启动了mesos slave,如下所示: sudo ./bin/mesos-slave.sh --master=127.0.0.1:5050 --work_dir=/var/lib/mesos --containerizers=docker,mesos --executor_registration_timeout=5mins 此外,我还尝试在localhost上创建docker repo的tar.gz文件,并将其复制到/etc并传递 URI: file///etc/docker.repo.tar.gz 我哪里出错了?在马拉松比赛的记录里,我能看到这个 None of the enabled containerizers (mesos) could create a container for the provided TaskInfo/ExecutorInfo message . 因此,我认为这是我的错误所在。
编辑:建议应用程序的马拉松日志:

[2016-09-26 12:29:30,418] INFO Task launch for 'task [nginx.c59c7403-83b6-11e6-a834-0a0027000000]' was accepted. 0 tasksToLaunch, 0 in flight, 1 confirmed.  not backing off (mesosphere.marathon.core.launchqueue.impl.AppTaskLauncherActor:marathon-akka.actor.default-dispatcher-8)
I0926 12:29:30.418325 90841088 master.cpp:3104] Processing ACCEPT call for offers: [ d165ac5e-93dc-4b7b-bf36-071ce75aa44d-O17 ] on slave d165ac5e-93dc-4b7b-bf36-071ce75aa44d-S0 at slave(1)@172.26.35.124:63837 (172.26.35.124) for framework fa8c0ef7-651b-41c2-8f1c-c24057bcfb58-0000 (marathon) at scheduler-c27b723e-e9d3-428a-b7d3-c8c184b1ed7c@172.26.35.124:63837
I0926 12:29:30.419334 90841088 master.hpp:177] Adding task nginx.c59c7403-83b6-11e6-a834-0a0027000000 with resources cpus(*):0.1; mem(*):256; ports(*):[31835-31835] on slave d165ac5e-93dc-4b7b-bf36-071ce75aa44d-S0 (172.26.35.124)
I0926 12:29:30.419400 90841088 master.cpp:3589] Launching task nginx.c59c7403-83b6-11e6-a834-0a0027000000 of framework fa8c0ef7-651b-41c2-8f1c-c24057bcfb58-0000 (marathon) at scheduler-c27b723e-e9d3-428a-b7d3-c8c184b1ed7c@172.26.35.124:63837 with resources cpus(*):0.1; mem(*):256; ports(*):[31835-31835] on slave d165ac5e-93dc-4b7b-bf36-071ce75aa44d-S0 at slave(1)@172.26.35.124:63837 (172.26.35.124)
I0926 12:29:30.419661 89767936 slave.cpp:1361] Got assigned task nginx.c59c7403-83b6-11e6-a834-0a0027000000 for framework fa8c0ef7-651b-41c2-8f1c-c24057bcfb58-0000
I0926 12:29:30.421689 90304512 gc.cpp:83] Unscheduling '/tmp/mesos/0/slaves/d165ac5e-93dc-4b7b-bf36-071ce75aa44d-S0/frameworks/fa8c0ef7-651b-41c2-8f1c-c24057bcfb58-0000' from gc
I0926 12:29:30.422006 89767936 gc.cpp:83] Unscheduling '/tmp/mesos/0/meta/slaves/d165ac5e-93dc-4b7b-bf36-071ce75aa44d-S0/frameworks/fa8c0ef7-651b-41c2-8f1c-c24057bcfb58-0000' from gc
I0926 12:29:30.422173 88158208 slave.cpp:1480] Launching task nginx.c59c7403-83b6-11e6-a834-0a0027000000 for framework fa8c0ef7-651b-41c2-8f1c-c24057bcfb58-0000
I0926 12:29:30.422904 88158208 paths.cpp:528] Trying to chown '/tmp/mesos/0/slaves/d165ac5e-93dc-4b7b-bf36-071ce75aa44d-S0/frameworks/fa8c0ef7-651b-41c2-8f1c-c24057bcfb58-0000/executors/nginx.c59c7403-83b6-11e6-a834-0a0027000000/runs/0548c84c-40ad-40cd-bbd8-b1330e66f348' to user 'bhjain'
I0926 12:29:30.445124 88158208 slave.cpp:5352] Launching executor nginx.c59c7403-83b6-11e6-a834-0a0027000000 of framework fa8c0ef7-651b-41c2-8f1c-c24057bcfb58-0000 with resources cpus(*):0.1; mem(*):32 in work directory '/tmp/mesos/0/slaves/d165ac5e-93dc-4b7b-bf36-071ce75aa44d-S0/frameworks/fa8c0ef7-651b-41c2-8f1c-c24057bcfb58-0000/executors/nginx.c59c7403-83b6-11e6-a834-0a0027000000/runs/0548c84c-40ad-40cd-bbd8-b1330e66f348'
I0926 12:29:30.446513 88158208 slave.cpp:1698] Queuing task 'nginx.c59c7403-83b6-11e6-a834-0a0027000000' for executor 'nginx.c59c7403-83b6-11e6-a834-0a0027000000' of framework fa8c0ef7-651b-41c2-8f1c-c24057bcfb58-0000
E0926 12:29:30.446702 88158208 slave.cpp:3784] Container '0548c84c-40ad-40cd-bbd8-b1330e66f348' for executor 'nginx.c59c7403-83b6-11e6-a834-0a0027000000' of framework fa8c0ef7-651b-41c2-8f1c-c24057bcfb58-0000 failed to start:**None of the enabled containerizers (mesos) could create a container for the provided TaskInfo/ExecutorInfo message**
E0926 12:29:30.446846 90841088 slave.cpp:3855] Termination of executor 'nginx.c59c7403-83b6-11e6-a834-0a0027000000' of framework fa8c0ef7-651b-41c2-8f1c-c24057bcfb58-0000 failed: Unknown container: 0548c84c-40ad-40cd-bbd8-b1330e66f348
I0926 12:29:30.453965 90841088 slave.cpp:3012] Handling status update TASK_FAILED (UUID: 90717092-98c0-4eab-9967-f43e005159b5) for task nginx.c59c7403-83b6-11e6-a834-0a0027000000 of framework fa8c0ef7-651b-41c2-8f1c-c24057bcfb58-0000 from @0.0.0.0:0
W0926 12:29:30.454391 91914240 containerizer.cpp:1295] Ignoring update for unknown container: 0548c84c-40ad-40cd-bbd8-b1330e66f348
I0926 12:29:30.454927 91377664 status_update_manager.cpp:320] Received status update TASK_FAILED (UUID: 90717092-98c0-4eab-9967-f43e005159b5) for task nginx.c59c7403-83b6-11e6-a834-0a0027000000 of framework fa8c0ef7-651b-41c2-8f1c-c24057bcfb58-0000
I0926 12:29:30.455751 91377664 status_update_manager.cpp:824] Checkpointing UPDATE for status update TASK_FAILED (UUID: 90717092-98c0-4eab-9967-f43e005159b5) for task nginx.c59c7403-83b6-11e6-a834-0a0027000000 of framework fa8c0ef7-651b-41c2-8f1c-c24057bcfb58-0000
I0926 12:29:30.456254 90304512 slave.cpp:3410] Forwarding the update TASK_FAILED (UUID: 90717092-98c0-4eab-9967-f43e005159b5) for task nginx.c59c7403-83b6-11e6-a834-0a0027000000 of framework fa8c0ef7-651b-41c2-8f1c-c24057bcfb58-0000 to master@172.26.35.124:63837
I0926 12:29:30.456456 91377664 master.cpp:4763] Status update TASK_FAILED (UUID: 90717092-98c0-4eab-9967-f43e005159b5) for task nginx.c59c7403-83b6-11e6-a834-0a0027000000 of framework fa8c0ef7-651b-41c2
gev0vcfq

gev0vcfq1#

从json模式的Angular 来看,json看起来不错。tbh,那个 cmd 如果您想在mesos上测试正在运行的容器,那么属性内容实际上是没有意义的。
我甚至认为您使用的命令将无法工作,在应用程序上下文中执行docker。。。
请使用像nginx这样的标准图像:

{
  "id": "nginx",
  "container": {
    "type": "DOCKER",
    "docker": {
      "image": "nginx",
      "network": "BRIDGE",
      "portMappings": [
        { "hostPort": 0, "containerPort": 80 }
      ],
      "forcePullImage":true
    }
  },
  "instances": 1,
  "cpus": 0.1,
  "mem": 256,
  "healthChecks": [{
      "protocol": "HTTP",
      "path": "/",
      "portIndex": 0,
      "timeoutSeconds": 10,
      "gracePeriodSeconds": 10,
      "intervalSeconds": 2,
      "maxConsecutiveFailures": 10
  }]
}

检查整体功能。如果有效,标记并按下按钮 nginx 图像到您的本地注册表,并尝试通过 uris 凭证传递方法和本地映像名称。

相关问题