skip to Main Content

Super weird problem for me. I am using docker desktop for windows x86. I am using ubuntu-22.04 installed via WSL to run all my docker commands. I have a project that I am pushing to AWS ECR however when I push, it created 2 images, one with a 0 MB size and another Image Index artifact (whatever that is). When I try and run my docker container in a lambda function I get errors that do not show up when I run the image that I push up using my macbook. When I run these exact same docker commands on my Macbook it works perfectly fine. When I make the docker push to my mackbook I see one image that works with the lambda. No clue what could be going on, can anyone help me diagnose what could possibly be going on or what I could try and test to see, I am totally lost.

Docker Commands

docker build -f Dockerfile.model.process -t processing/model/processing .
docker tag processing/model/processing:latest ****.dkr.ecr.us-east-2.amazonaws.com/processing/model/processing:latest
aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin ****.dkr.ecr.us-east-2.amazonaws.com
docker push ****.dkr.ecr.us-east-2.amazonaws.com/processing/model/processing:latest

What ECR looks like when I push up with my windows machine:

enter image description here

What ECR looks like when I push using the exact same commands with my macbook:
enter image description here

2

Answers


  1. Docker Desktop on Windows, especially with WSL2, might be configured to use buildx or experimental features by default. This allows for building multi-platform images but can lead to unintended behaviors if you’re not explicitly targeting a platform. AWS Lambda requires a specific architecture (e.g., linux/amd64 or linux/arm64). If the pushed image is a manifest list or index (multi-architecture), Lambda might not handle it correctly.

    Your MacBook likely has a simpler Docker setup that builds single-platform images by default, which works seamlessly with your AWS Lambda.

    To ensure compatibility with AWS Lambda, explicitly set the platform to linux/amd64 when building the Docker image. Modify your docker build command:

    docker build --platform=linux/amd64 -f Dockerfile.model.process -t processing/model/processing .
    

    the latest file with 0.00MB is the provenance attestations , if you don’t need these build provenance attestations (and they aren’t required for your use case), you can disable their generation by adding --provenance=false to your build command.

    Login or Signup to reply.
  2. I ran into this problem on Windows 11 using the latest version of Docker Desktop.

    Sprinkle the magic (no quotes) ‘–provenance false’ on your build and you only get the image you need.

    The full command is this

    docker build --platform linux/amd64 --provenance false -t docker-image:test .
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search