I tried to run cloudnativelabs/whats-my-ip on GCP (Cloud Run), but it failed:
/home/server: line 1: syntax error: unexpected "("
Container called exit(2).
The image contains a Go program, but this looks like it tries to run it as a script. Because there's no syntax when you run a binary.
What's happening here? Why does it fail? Does it really think the entrypoint is a script? A shell script? Why?
Is this a duplicate of the exec format error? No, at least the message is different. And as far as I can tell architectures on Docker Hub and Cloud Run match.
Steps to reproduce:
resource "google_cloud_run_v2_service" "cloud-run-test" {
name = "cloud-run-test"
location = "europe-central2"
template {
containers {
image = "cloudnativelabs/whats-my-ip"
}
}
}
$ terraform init
$ terraform apply
$ gcloud logging read 'logName:projects/PROJECT_ID/logs/run.googleapis.com%2F' --format 'text(logName, textPayload, timestamp)' --project PROJECT_ID
---
log_name: projects/PROJECT_ID/logs/run.googleapis.com%2Fvarlog%2Fsystem
text_payload: Container called exit(2).
timestamp: 2023-12-09T03:40:23.628609204Z
---
log_name: projects/PROJECT_ID/logs/run.googleapis.com%2Fstderr
text_payload: /home/server: line 1: syntax error: unexpected "("
timestamp: 2023-12-09T03:40:22.632415Z
I moved my experiments with the image to this gist.
This is not exactly the reason (depends on your definition) but this is as close as I could probably hope to get. According to the fragment of the docs John Hanley quoted:
The reason is apparently because
/home/serveris a 32-bit binary.