user1275607
user1275607

Reputation: 99

aws lambda docker fork/exec permission denied

I am trying to use AWS lambda with docker container. The container is built starting from ubuntu:latest

When running test with AWS lambda console, I get following error:

Launch error: fork/exec /root/miniconda3/bin/python: permission denied
Entrypoint: [/root/miniconda3/bin/python,-m,awslambdaric]

The /root/miniconda3/bin/python and awslambdaric files do have correct permission.

Any idea what could be reason?

Upvotes: 4

Views: 3929

Answers (3)

Sergio Lema
Sergio Lema

Reputation: 1629

I had the same problem running a Python application in a Docker image in AWS Lambda.

The Python files were copied into the root directory, and it had no access when Lambda tried to access them.

The solution was to use WORKDIR /project in the Dockerfile to copy all the content into a folder everyone can access. Then, when I trigger the Lambda, I have all the necessary accesses.

Upvotes: 0

Himanshu Sinha
Himanshu Sinha

Reputation: 9

Adding RUN chmod 777 /root in Dockerfile worked for me .

Upvotes: 0

JerryInCBus
JerryInCBus

Reputation: 31

I just ran into a similar issue where /root had drwxr-x--- permissions (i.e. "others" could not read or execute). When this runs under Lambda, it doesn't run as root so it cannot access directories that are not readable/executable by "other".

When I added "RUN chmod o+rx /root" to my Dockerfile, my lambda ran successfully.

BTW, also check that /root/miniconda3/bin/python is not a symbolic link. I read somewhere that that could also cause this error.

Upvotes: 3

Related Questions