`fly machine run` within a Docker container - Error could not launch machine / Post connect tcp operation timed out

I’m looking to build a web service that can start fly machine run instances. While it seems to begin the machine build, it gets stuck and spits out the following error message:

# Console output:
Image: registry-1.docker.io/library/hello-world:latest
Image size: 2.5 kB
Machine is launching...
# ... error returned:
Error could not launch machine: Post "http://[fdaa:0:3804::3]:4280/v1/machines": connect tcp [fdaa:0:3804::3]:4280: operation timed out
  • Is there some sort of Dockerfile configuration (for my web service that is calling flyctl) I need to do in order to make that connection succeed?

  • Or is this a symptom of a different configuration issue?

Confirmed I am able to use the same command on my local shell and deploy that image.


Additional setup info:

I’m roughly following the steps for deploying with fly.io on GitLab, but running within a GCP Cloud Run instance.

Installation in the GCP Cloud Run Dockerfile:

RUN set -x && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
    --no-install-recommends \
    curl && \
    rm -rf /var/lib/apt/lists/*
RUN curl -L https://fly.io/install.sh | sh

Deploying with a GCP-secrets-manager-configured fly_api_token secret set:

gcloud run deploy --region=us-east4 --update-secrets=FLY_API_TOKEN=fly_api_token:latest --source=. [GCP CLOUD RUN APP NAME]

Running the flyctl command within a bash context:

/root/.fly/bin/flyctl machine run hello-world -a [APP_NAME]