Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error building Dockerized AWS Lambda Function #6478

Closed
ilfoxo opened this issue Dec 21, 2023 · 3 comments
Closed

Error building Dockerized AWS Lambda Function #6478

ilfoxo opened this issue Dec 21, 2023 · 3 comments
Labels
area/build sam build command blocked/close-if-inactive Blocked for >14 days with no response, will be closed if still inactive after 7 days type/question

Comments

@ilfoxo
Copy link

ilfoxo commented Dec 21, 2023

I'm trying to create a Dockerized Lambda function, but when i try to build the template Im getting this error:

PS D:\Development\Python\function-dockers> sam build
Building codeuri: D:\Development\Python\function-dockers runtime: None metadata: {'DockerTag': 'python-3.11', 'DockerContext': 'D:\\Development\\Python\\function-dockers\\ortools_docker',  
'Dockerfile': 'Dockerfile'} architecture: x86_64 functions: OrToolsFunction
Building image for OrToolsFunction function
Setting DockerBuildArgs: {} for OrToolsFunction function
Failed building function OrToolsFunction

Build Failed
Error: The command '/bin/sh -c python -m pip install -r requirements.txt -t .' returned a non-zero code: 1

The container is created, but not executed:

CONTAINER ID   IMAGE          COMMAND                  CREATED             STATUS                         PORTS     NAMES
0fc32ff9148c   032ecf6bfee8   "/bin/sh -c 'python …"   3 minutes ago       Exited (1) 3 minutes ago                 interesting_napier

When I try to run the container from docker and check the log, this is the output:

Error response from daemon: configured logging driver does not support reading

In the attached file:
template.yaml
Dockerfile
app.py
requirements.txt

function-dockers.zip

SAM Version:
SAM CLI, version 1.105.0

OS:
Windows 10
Amazon Linux 2

How to reproduce the error:
Unzip the attached file and run: sam build --use-container -t template.yaml

@ilfoxo ilfoxo added the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label Dec 21, 2023
@hawflau hawflau added stage/bug-repro The issue/bug needs to be reproduced and removed stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Dec 27, 2023
@hawflau
Copy link
Contributor

hawflau commented Dec 27, 2023

Hi @ilfoxo, thanks for raising the issue.

This is what I got when I ran docker build -t test-image .:

#0 building with "desktop-linux" instance using docker driver

#1 [internal] load .dockerignore
#1 transferring context: 2B done
#1 DONE 0.0s

#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 287B done
#2 DONE 0.0s

#3 [internal] load metadata for public.ecr.aws/lambda/python:3.11
#3 DONE 0.0s

#4 [internal] load build context
#4 transferring context: 486B done
#4 DONE 0.0s

#5 [1/4] FROM public.ecr.aws/lambda/python:3.11
#5 DONE 0.0s

#6 [2/4] COPY app.py ./
#6 DONE 0.0s

#7 [3/4] COPY requirements.txt ./
#7 DONE 0.0s

#8 [4/4] RUN python -m pip install -r requirements.txt -t .
#8 0.573 ERROR: Could not find a version that satisfies the requirement orttols (from versions: none)
#8 0.574 ERROR: No matching distribution found for orttols
#8 0.666 
#8 0.666 [notice] A new release of pip is available: 23.2.1 -> 23.3.2
#8 0.666 [notice] To update, run: pip install --upgrade pip
#8 ERROR: process "/bin/sh -c python -m pip install -r requirements.txt -t ." did not complete successfully: exit code: 1
------
 > [4/4] RUN python -m pip install -r requirements.txt -t .:
0.573 ERROR: Could not find a version that satisfies the requirement orttols (from versions: none)
0.574 ERROR: No matching distribution found for orttols
0.666 
0.666 [notice] A new release of pip is available: 23.2.1 -> 23.3.2
0.666 [notice] To update, run: pip install --upgrade pip
------
Dockerfile:4
--------------------
   2 |     COPY app.py ./
   3 |     COPY requirements.txt ./
   4 | >>> RUN python -m pip install -r requirements.txt -t .
   5 |     CMD ["app.lambda_handler"]
   6 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c python -m pip install -r requirements.txt -t ." did not complete successfully: exit code: 1

Is orttols from a private repository or from local?

@hawflau hawflau added type/question area/build sam build command and removed stage/bug-repro The issue/bug needs to be reproduced labels Dec 27, 2023
@hawflau hawflau added the blocked/close-if-inactive Blocked for >14 days with no response, will be closed if still inactive after 7 days label Jan 8, 2024
@hnnasit
Copy link
Contributor

hnnasit commented Jan 19, 2024

Closing this since the issue has been inactive for a while. Feel free to open a new issue with more details if you are still facing issues or have questions.

@hnnasit hnnasit closed this as completed Jan 19, 2024
Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build sam build command blocked/close-if-inactive Blocked for >14 days with no response, will be closed if still inactive after 7 days type/question
Projects
None yet
Development

No branches or pull requests

3 participants