Docker images are often multi-architecture. When you run docker pull or docker build, Docker picks the variant that matches your machine. If you’re on an Apple Silicon Mac (M1, M2, M3, M4), that means Docker quietly pulls the linux/arm64 image. That’s fine if you’re running it locally, but push that image to a container service running x86 and you’ll get:

FATAL TINI(7) EXEC FORMAT ERROR

ECS Fargate defaults to linux/amd64 (x86_64) compute unless you explicitly set ARM in the task definition. When Fargate tries to execute an ARM64 binary on an x86 host, the Linux kernel can’t run it. In my case the first process to fail was tini, a lightweight init process baked into many base images, which is where that error message comes from. This mismatch can appear on other container services too, but Fargate is where I hit it.

The fix

Tell Docker exactly which platform you want when you pull or build:

docker pull --platform linux/amd64
docker build --platform linux/amd64

The --platform linux/amd64 flag overrides the default behaviour of matching your host architecture. Docker will fetch (or build from) the x86_64 variant regardless of what chip your Mac has.

But why doesn’t it just pull the right one?

If you’re pulling a third-party multi-arch image on your Mac and then pushing it to something like ECR, this is where it goes wrong. When you run docker pull some-vendor/image:latest on an M-series Mac, Docker looks at the multi-arch manifest, sees your machine is arm64, and pulls only the arm64 variant. This is by design. Docker only downloads what your host needs to save bandwidth and disk. It doesn’t pull both architectures.

So now your local Docker has a single-architecture arm64 image. When you tag it and docker push to ECR, you’re pushing that single arm64 image and the original multi architecture manifest is gone. ECR just has an arm64 image sitting in it, so when Fargate pulls it, it’s trying to run arm64 binaries on x86 and you get the error.

Forcing the platform on pull

If you just need it working, force the platform on the pull:

docker pull --platform linux/amd64 some-vendor/image:latest
docker tag some-vendor/image:latest 123456789.dkr.ecr.eu-west-1.amazonaws.com/my-image:latest
docker push 123456789.dkr.ecr.eu-west-1.amazonaws.com/my-image:latest

This works but the image in ECR is now amd64-only so has no multi architecture support like it would have done before.

The proper fix: copy the full multi-arch image

If you want to keep all architecture variants intact so that any host pulling the image gets the right one automatically then use a tool like crane which can copy images directly between registries, preserving the full manifest list:

# crane copies all architecture variants by default
crane copy some-vendor/image:latest \
  123456789.dkr.ecr.eu-west-1.amazonaws.com/my-image:latest

This copies the entire manifest list, which contains all architures, straight from one registry to the other. Fargate then pulls the amd64 variant automatically because ECR has the full multi-arch manifest to serve from. You can also pull a specific architecture using crane’s --platform flag if needed.

crane is part of go-containerregistry.

Building images with docker

docker buildx build --platform linux/amd64,linux/arm64