Is there a way to use docker manifest-list to build multi-arch images in ECR?

I am trying to use Amazon ECR for storing my images.

Now, I want my image:tag to work with different operating system and architectures like linux/amd64, linux/arm64, windows etc.

This is fine when I use docker but seems like I can’t make it work with ECR.

Docker says you can push it to an insecure registry:

Failed command:

docker buildx build --platform linux/amd64,linux/arm64 -t --push .

This command succeeds:

docker buildx build --platform linux/arm64 -t --push .

The multi-platform image can be pushed to Docker Hub.

I want to know a way how we can do this. This is my thought. Please correct me if I am wrong.

Can we create our own manifest file which contains the images already placed in ECR repository?

Something like:

image: image:multi-arch
             architecture: arm64
      os: linux

             architecture: intelx86
      os: Windows

Now we have a new image called image:multi-arch. We then use this image and expect it to get the target architecture automatically based on the manifest.

If I push this final image to ECR, will it work?
Am I doing something wrong? Please feel free to correct me.

Source: StackOverflow