- Newest
- Most votes
- Most comments
The error message exec /docker-entrypoint.sh: exec format error does, indeed, mean that the container image either has been built for Arm and you are trying to run it as an x86 Fargate task, or vice versa that the container image has been built for x86 and you are trying to run it as a Graviton Fargate task.
I'm not familiar enough with the CDK constructs you are using, but would start by checking the container image that you have in the repo and then the ECS task definition for the task to make sure the settings match how the container image is built. In particular, you'll want to look at the cpuArchitecture setting.
Unless explicitly defined, cpuArchitecture defaults to X86_64, but needs to be set to ARM64 to run the task on Graviton.
answered 2 years ago
You must make sure that your Docker build environment is on the same OS as the ApplicationLoadBalancedFargateService, which defaults to x86_64 as @Mats stated above. For example, if you have a Mac or Windows laptop, and you run cdk deploy locally... that would make your container potentially incompatible with the ECS Pattern. This also explains why the deployment "hangs", because it cannot successfully deploy the container to the ECS cluster.
You can create a cdk pipeline, which would also build your Docker image on a Linux based environment - as you can see in this video tutorial: https://www.youtube.com/watch?v=EVDw0sdxaec.
Alternatively, I'd like to recommend that you use this library that I built! https://constructs.dev/packages/token-injectable-docker-builder. It allows you to build your Docker images in a Linux-based OS environment at deployment time instead of at build time.
Let me know if this helps!
answered 2 years ago
Relevant content
asked 2 years ago
