Home > database >  AWS CDK Python docker throwing invalid bind mount error when trying to bundle code
AWS CDK Python docker throwing invalid bind mount error when trying to bundle code

Time:11-25

I'm trying to deploy a python lambda function with dependencies and I'm getting an error from the docker daemon (on Centos linux) that there is an invalid bind mount spec. The error is "/path//to/my/code:/asset-input:z,delegated": invalid mode: delegated

The following is what my code looks like for the lambda function:

        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,
        )

This works just fine on my Mac, but trying to deploy from Centos is unsuccessful.

CodePudding user response:

Your docker version is out of date. You need to be running docker CE at least version 1.17.04 or higher (this was the version when support for delegated mode was added, but ideally you should install a more recent version).

As stated in comments, your current version is 1.13.1, which does not have support for this mode.

To resolve this, you should update your docker version.

  • Related