Container failed to start due to exec format error

I’m getting a weird Docker error when trying to run my container on an endpoint. Note that the container does work when running the pre-release command. I’m sure it’s a bug on my side, but the logging I see in the output isn’t helpful. Perhaps you can give me more context? Here’s what I see when I try to add the endpoint or restart it via the CLI:

ERROR -- : SUMMARY: Execution failed because of:
ERROR -- : - FAILED: Wait up to 180s for containers in service cmd to respond to HTTP health checks
WARN -- :
WARN -- : WARNINGS: The following warnings or errors were logged during execution, review them now:
ERROR -- : 2 of 1 HTTP health checks failed
ERROR -- : Container for cmd (running [...]) failed to start (exited with status 1 after 0 seconds).
ERROR -- : standard_init_linux.go:228: exec user process caused: exec format error
ERROR -- : For more information, review: https://deploy-docs.aptible.com/docs/http-health-checks-failed/

The relevant line here is:

As described in this Stack Overflow post, there are two common reasons for this error.

The first cause is that the file being executed has an invalid or missing shebang (#!) line at the beginning of the file. This can be remedied by adding a valid shebang line, e.g. #!/bin/bash.

The second cause is that the image being run was built using a --platform that the host running the container does not support. Most recently we’ve seen this occur with images built on Macs with Apple Silicon processors (e.g. M1, M1 Pro, M1 Max) as they default to linux/arm64 which is not supported by the hosts that Aptible uses. This can be mitigated by adding --platform linux/amd64 to the docker build command when building for deployment on Aptible.