chronos无法运行专用docker容器

eqfvzcg8  于 2021-06-26  发布在  Mesos
关注(0)|答案(2)|浏览(344)

我在本地主机上玩dc/os安装。虽然一切正常,但我似乎无法运行位于私人回购内的docker映像。我正在使用python与chronos通信:

@celery.task(name='add-job', soft_time_limit=5)
def add_job(job_id):
    job_document = mongo.jobs.find_one({
        '_id': job_id
    })

    if job_document:
        worker_document = mongo.workers.find_one({
            '_id': job_document['workerId']
        })

        if worker_document:
            job = {
                'async': True,
                'name': job_document['_id'],
                'owner': 'owner@gmail.com',
                'command': "python /code/run.py",
                "disabled": False,
                "shell": True,
                "cpus": worker_document['cpus'],
                "disk": worker_document['disk'],
                "mem": worker_document['memory'],
                'schedule': 'R1//PT300S',# start now,
                "epsilon": "PT60M",
                "container": {
                    "type": "DOCKER",
                    "forcePullImage": True,
                    "image": "quay.io/username/container",
                    "network": "HOST",
                    "volumes": [{
                        "containerPath": "/images/",
                        "hostPath": "/images/",
                        "mode": "RW"
                    }]
                },
                "uris": [
                    "file:///images/docker.tar.gz"
                ]
            }
            return chronos_client.add(job)
        else:
            return 'worker not found'
    else:
        return 'job not found'

这项工作运作良好,公众形象良好( alpine:latest )但它在dcos安装中没有任何错误。
作业得到执行,但立即失败。chronos中作业的错误日志如下所示:

I1212 12:39:11.141639 25058 fetcher.cpp:498] Fetcher Info: {"cache_directory":"\/tmp\/mesos\/fetch\/slaves\/61d6d037-c9f5-482b-a441-11d85554461b-S1\/root","items":[{"action":"BYPASS_CACHE","uri":{"cache":false,"executable":false,"extract":false,"value":"file:\/\/\/images\/docker.tar.gz"}}],"sandbox_directory":"\/var\/lib\/mesos\/slave\/slaves\/61d6d037-c9f5-482b-a441-11d85554461b-S1\/docker\/links\/7029bbea-4c3d-439a-8720-411f6fe40eb9","user":"root"}
I1212 12:39:11.143575 25058 fetcher.cpp:409] Fetching URI 'file:///images/docker.tar.gz'
I1212 12:39:11.143587 25058 fetcher.cpp:250] Fetching directly into the sandbox directory
I1212 12:39:11.143602 25058 fetcher.cpp:187] Fetching URI 'file:///images/docker.tar.gz'
I1212 12:39:11.143612 25058 fetcher.cpp:167] Copying resource with command:cp '/images/docker.tar.gz' '/var/lib/mesos/slave/slaves/61d6d037-c9f5-482b-a441-11d85554461b-S1/docker/links/7029bbea-4c3d-439a-8720-411f6fe40eb9/docker.tar.gz'
I1212 12:39:11.146726 25058 fetcher.cpp:547] Fetched 'file:///images/docker.tar.gz' to '/var/lib/mesos/slave/slaves/61d6d037-c9f5-482b-a441-11d85554461b-S1/docker/links/7029bbea-4c3d-439a-8720-411f6fe40eb9/docker.tar.gz'

标准输出为空。作为一个应用程序直接在马拉松内部执行,使用相同的设置,身份验证工作,我的图像被下载并执行。这是chronos不支持的吗?它应该…我是说,它有命令给docker。。。
更新:深入挖掘代理日志我发现: Failed to run 'docker -H unix:///var/run/docker.sock pull quay.io/username/container': exited with status 1; stderr='Error: Status 403 trying to pull repository username/container: "{\"error\": \"Permission Denied\"}" 我用代理本身的config.json文件尝试了存档,当从命令行触发时可以下载。我只是不明白为什么chronos没有正确使用它。除此之外,我找不到其他关于如何放置我的凭据的参考资料。

nvbavucw

nvbavucw1#

你的帖子看起来有点像这个,结果是卷有问题。

cu6pst1q

cu6pst1q2#

结果是…uris参数被弃用,取而代之的是fetch。我从零开始,将马拉松配置应用于chronos,当我看到以下内容时,我仔细观察了日志: {'message': 'Tried to add both uri (deprecated) and fetch parameters on aBPepwhG5z33e4teG', 'status': 'Bad Request'} . 然后我将uris参数改为:

"fetch": [{
    "uri": "/images/docker.tar.gz",
    "extract": true,
    "executable": false,
    "cache": false
}]

……而且成功了。

相关问题