2 Risposte
- Più recenti
- Maggior numero di voti
- Maggior numero di commenti
0
Yes you could append the host platform on it. But the issue is a difference between where you build the image and the Architecture setting on the lambda.
Example: if you build the image on an m1 mac push to ECR and set the Architecture setting to x86_64 then you will get this error.
You can either change the setting in lambda or if you are working with multiple people on different systems Id suggest using CodePipeline with a CodeBuild step and you can define the system the pipeline builds on so every-time the build is consistent with a buildspec.yaml like this.
version: 0.2 phases: install: runtime-versions: docker: 18 pre_build: commands: - echo Logging in to Amazon ECR... - aws --version - $(aws ecr get-login --region $AWS_DEFAULT_REGION --no-include-email) - REPOSITORY_URI=$EcrRepo - COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7) - IMAGE_TAG=${COMMIT_HASH:=latest} build: commands: - echo Build started on `date` - echo Building the Docker image... - docker build -t $REPOSITORY_URI:latest . - docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG post_build: commands: - echo Build completed on `date` - echo Pushing the Docker images... - docker push $REPOSITORY_URI:latest - docker push $REPOSITORY_URI:$IMAGE_TAG - aws lambda update-function-code --function-name [YOUR_FUNCTION_NAME] --image-uri $REPOSITORY_URI:$IMAGE_TAG
con risposta 2 anni fa
Contenuto pertinente
- AWS UFFICIALEAggiornata un anno fa
Thank you. I am trying to build the image and I get an error when it tries to install the PIP packages:
[Warning] The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested standard_init_linux.go:228: exec user process caused: exec format error
I tried running the build command like: docker build -t IMAGENAME . --platform linux/arm64 But it still gives me the same error.
Is there a special way I have to build the image?