aws / aws-lambda-runtime-interface-emulator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Order of `--entrypoint` in example appears incorrect

gwk opened this issue · comments

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!

Same for Docker Desktop for Windows.

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

Thank you!