代码之家  ›  专栏  ›  技术社区  ›  Jasonca1

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

  •  0
  • Jasonca1  · 技术社区  · 3 年前

    我试图部署一个带有依赖项的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部署失败。

    0 回复  |  直到 3 年前
        1
  •  1
  •   sytech    3 年前

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

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

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