aws / aws-lambda-runtime-interface-emulator

Apache License 2.0
936 stars 99 forks source link

Order of `--entrypoint` in example appears incorrect #31

Closed gwk closed 2 years ago

gwk commented 3 years ago

After much frustration, I just discovered that the following command in the readme does not quite work: docker run -d -v ~/.aws-lambda-rie:/aws-lambda -p 9000:8080 myfunction:latest --entrypoint /aws-lambda/aws-lambda-rie <image entrypoint> <(optional) image command>

On Docker version 20.10.5, build 55c4c88 for Mac (apple silicon), docker run appears to completely ignore the --entrypoint argument unless it is written before the image name.

Here is what ended up working for me:

docker run \
    --detach \
    --volume ~/.aws-lambda-rie:/aws-lambda \
    --publish 9000:8080 \
    --entrypoint /aws-lambda/aws-lambda-rie \
    myfunction:latest \
    /usr/local/bin/python3 -m awslambdaric func.handler

Where func.handler refers to a file func.py that contains:

def handler(event, context):
  return "My handler result."

If you agree, please update the readme. Thanks!

mcaulifn commented 3 years ago

Same for Docker Desktop for Windows.

ghost commented 2 years ago

Thank you for reporting the issue gwk, this was resolved in the pull request #36 so I am closing the issue.

Thank you!