Skip to content

image entrypoint documentation #24

Closed
@diegosasw

Description

@diegosasw

I'm trying to run a local container that has been created as a lambda dotnet 5 image following an Amazon template.
In other words, I have a dotnet 5 project with a AWS lambda function which I have created with

dotnet new -i Amazon.Lambda.Templates
dotnet new serverless.image.AspNetCoreWebAPI -n LambdaDotNet5
dotnet build -c Release
dotnet publish -c Release

This creates a dotnet project with a simple Dockerfile (notice there is no entry point or anything) and compiles it and publishes its artifacts in a folder.

FROM public.ecr.aws/lambda/dotnet:5.0
WORKDIR /var/task
COPY "bin/Release/net5.0/publish"  .

Notice by default this line was COPY "bin/Release/net5.0/linux-x64/publish" . but my dotnet publish -c Release places it under publish folder, without the linux-x64 part.
Now I follow the instructions described and I can build a docker image locally

docker build -t lambda-dotnet .

Using a git-bash linux-like terminal in Windows I run

mkdir -p ~/.aws-lambda-rie && curl -Lo ~/.aws-lambda-rie/aws-lambda-rie https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie && chmod +x ~/.aws-lambda-rie/aws-lambda-rie

and I can see the emulator properly downloaded

ls -la ~/.aws-lambda-rie/aws-lambda-rie
-rw-r--r-- 1 diego.martin 1049089 8155136 Feb 22 13:32 /c/Users/diego.martin/.aws-lambda-rie/aws-lambda-rie

Now I want to run the emulator with my container, so here's where I'm not sure what am I doing or what may be the problem

docker run -d -v ~/.aws-lambda-rie:/aws-lambda -p 9000:8080 --entrypoint /aws-lambda/aws-lambda-rie lambda-dotnet:latest

Notice I don't specify any entrypoint because I don't have any in my image. So the output is

54b355026ba16fc12d5884b38ff4f9cb481e007ac1cdbc222f17666891c9aa94
docker: Error response from daemon: OCI runtime create failed: container_linux.go:370: starting container process caused: exec: "C:/Users/diego.martin/AppData/Local/Programs/Git/aws-lambda/aws-lambda-rie": stat C:/Users/diego.martin/AppData/Local/Programs/Git/aws-lambda/aws-lambda-rie: no such file or directory: unknown.

What am I missing and what would be the command to run the RIE with my lambda container?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions