I came across an issue attempting to deploy a GCP cloud run service. After building my golang docker image, uploading to container repository and deploying to GCP cloud run, I kept receiving the following error when GCP attempted to run on port 8080:

Application failed to start: Failed to create init process:
failed to load /root/main: exec format error

What I found out was, Apple M1 by default does not build docker images in a format which can be executed on intel based devices. This means these executables won’t work on GCP. To resolve this, the --platform flag must be explicitly set when running docker build

docker build --platform linux/amd64

This resulted in a successful deploy.