Py学习  »  Python

AWS CDK Python docker在尝试绑定代码时抛出无效绑定装载错误

Jasonca1 • 4 年前 • 1917 次点击  

我试图部署一个带有依赖项的python lambda函数,但docker守护进程(在Centos linux上)发现一个错误,即存在无效的绑定装载规范。错误是 "/path//to/my/code:/asset-input:z,delegated": invalid mode: delegated

以下是lambda函数的代码:

        python_function = Function(
            self,
            id="PythonFunction",
            runtime=Runtime.PYTHON_3_9,
            handler="app.main.lambda_handler",
            timeout=Duration.seconds(20),
            code=Code.from_asset(
                path=str(python_function_path.resolve()),
                bundling=BundlingOptions(
                    image=Runtime.PYTHON_3_9.bundling_image,
                    command=[
                        "bash",
                        "-c",
                        "pip install -r requirements.txt -t /asset-output && cp -au . /asset-output",
                    ],
                ),
            ),
            memory_size=128,
            log_retention=RetentionDays.TWO_WEEKS,
        )

这在我的Mac上运行良好,但尝试从Centos部署失败。

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/131817
文章 [ 1 ]  |  最新文章 4 年前
sytech
Reply   •   1 楼
sytech    4 年前

你的docker版本已经过时了。您需要运行docker CE至少1.17.04或更高版本(这是支持 delegated 添加了模式,但理想情况下应该安装更新的版本)。

如评论中所述,您当前的版本是1.13.1,不支持此模式。

要解决这个问题,您应该更新docker版本。