Lambda function from container - Missing Parent Directory

0

I've a built a container image that I'm able to execute locally. The container works well with aws-lambda-rie.

However, when trying to create lambda function in the console with it, I encounter:

"Failed to create the function xxxxxx : MissingParentDirectory: Parent directory does not exist for file: ./usr/share/doc/ca-certificates/copyright"

The folder exists on the container. What could be causing this error? Are there other undocumented requirements for containers to be lambda compatible?

질문됨 2년 전790회 조회
2개 답변
0

In our case the same error was seemingly caused by the missing directory entries in the image filesystem. You can verify their presence by first doing docker export to tar file:

docker image ls
# find out the image you need
docker create --name="image-export" <your-image-here>
docker export "image-export" > "image-export.tar"
docker rm "image-export"

and then listing its contents via tar tf image-export.tar. The example ouput below contains directory entries (lines ending with "/")

app/
app/app.bin
bin/
bin/bash
bin/cat

The image having those lines in tar tf output was working properly on Lambda while the image that haven't had them failed with error message similar to what you've encountered.

vz
답변함 2년 전
0

We tracked down the issue to distroless - https://github.com/GoogleContainerTools/distroless/blob/3cfaaa01d9e53c2cd17b9fba8e3877981f5b4349/cacerts/cacerts.bzl#L31

Tar layer created with a file under /usr/share/doc/ca-certificates/copyright but without including empty folders for the tree structure leading up to it /usr, /usr/share, ... etc was causing the issue.

답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠