-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
sam local invoke
(Using HelloWorld template throws "Error: Error building docker image"
#3169
Comments
@kingram6865 Thanks for posting the issue. I was trying to reproduce the issue and Briefly looking into the code, this error happens when SAM CLI call Docker client to build image. I would suggest check if your Docker is running properly. Were you able to make it running correctly? If yes, what's is the difference between working setup and not working setup? Found a similar issue here: #2622 |
It looks like sam cli is looking for this This tool works on my x86 Ubuntu computer but that is not the machine where I want to run the edge. If you have any suggestions I would love it. |
Yes Could you provide me more details about your environment details? Is it a x86 Ubuntu? What's your docker version? |
Machine details: |
@kingram6865 This command should be the one to use: Let me know how it goes |
It didn't work. I'm no longer at that position so it's moot now. I may work on it for a private project in time. |
Are you looking for us to continue to help debugging on this, or should we close? |
Thanks for asking. I think it's appropriate to close this issue now. |
|
This issue seems to be recurring now. We are encountering below error while locally invoking a lambda in AWS code build machine Image was not found.842 | Building image............................................................................................................................ Build machine specs: AWS CodeBuild - Linux env |
We are also facing same issue during sam build-
SAM CLI, version 1.27.2
|
I added the line:
in docker/lambda_image.py:244. The
Could it be this the problem? SAM CLI, version 1.26.0 |
I made it work. The problem is that the: So I edited the and I forced it adding this line [in And the image was built and ran fine. |
Thanks @princio for your investigation! |
I have fixed this issue by running this command docker run --rm --privileged multiarch/qemu-user-static --reset -p yes |
Fixed from @ninjasujan worked for me too. I migrated from intel to M1 and then back to Intel... |
In my case I was facing this when running SAM in a Gitlab docker runner. import { Runtime, Tracing, Architecture, SingletonFunctionProps } from "aws-cdk-lib/aws-lambda";
import { execSync } from "child_process";
const arch = execSync("uname -m").toString();
export const defaultFunctionProps: Pick<
SingletonFunctionProps,
"runtime" | "memorySize" | "tracing" | "architecture"
> = {
runtime: Runtime.NODEJS_14_X,
memorySize: 256,
tracing: Tracing.ACTIVE,
architecture: arch === "arm64" ? Architecture.ARM_64 : Architecture.X86_64
}; |
still have the issue even after running @ninjasujan command !: |
Same problem as @jmamin here when running 'docker run --rm --privileged multiarch/qemu-user-static --reset -p yes' in a Apple M1 mac: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested I've tried what @princio proposed, but the other way around - forcing to ARM instead of forcing x86. Let me explain it better: In file lambda_image.py, I've added a LOG.info in '_build_image' function before calling '_generate_dockerfile' to know what base_image and architecture variables are set:
By forcing the image name and arch to latest and arm64:
@mgrandis: would it be possible to fix it? do not hesitate to ping me for any other info that might help. Thanks in advamce |
In my case, the solution turned out to be simple. Needed to change the
to
See this thread on StackOverflow |
It worked for me. I am running on a Mac M1 with colima instead of conventional docker |
Do that and run
|
yep ... me too just like this ! i've been going back and forth with this issue for a while now. Would love to see a solution |
Description:
When invoking sam build docker fails to build the image
Steps to reproduce:
Observed result:
Docker says:
Expected result:
Mounting /home/kingram/WORK/tmp/samtest/.aws-sam/build/HelloWorldFunction as /var/task:ro,delegated inside runtime container
START RequestId: 67bb22f1-747e-4655-92ad-c681f5482447 Version: $LATEST
END RequestId: 67bb22f1-747e-4655-92ad-c681f5482447
REPORT RequestId: 67bb22f1-747e-4655-92ad-c681f5482447 Init Duration: 0.08 ms Duration: 58.41 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 128 MB
No Content-Type given. Defaulting to 'application/json'.
2021-08-06 22:01:33 192.168.1.161 - - [06/Aug/2021 22:01:33] "GET /hello HTTP/1.1" 200 -
2021-08-06 22:01:34 192.168.1.161 - - [06/Aug/2021 22:01:34] "GET /favicon.ico HTTP/1.1" 403 -
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
: 1.27.2Add --debug flag to command you are running
Other command:
The text was updated successfully, but these errors were encountered: