Search code examples
amazon-web-servicesdockeramazon-ecs

How to deploy single-platform image to ECR after building with --platform flag?


I'm building a Docker image on macOS like this:

$ docker build . --platform linux/arm64 -t foo

Then, I push it to AWS ECR:

$ docker push foo

As a result, I see three files in the ECR (it's a multi-architecture manifest along with the image, I suppose). Is it possible to have only one image in ECR, without the multi-architecture manifest? In other words, I want to build for arm64 and deploy it to ECR as a single-platform image.


Solution

  • With a recent version of docker engine API (1.46+) you can use the --platform flag when pushing, e.g.:

    $ docker push foo --platform linux/arm64