From the details that you’ve provided, try using gcloud run services proxy command, then --address flag. This is to be specific with the IP address to listen to by the proxy. Originally, it listens on 127.0.0.1, but there should be no problem changing it to 0.0.0.0 to make it accessible from outside the container. Below is the sample command:
gcloud run services proxy --address 0.0.0.0 --port 8080 <your-service-name>
For more details, you can check this documentations:
Can you share the code or at least what language it’s in, there should be a way to force your function to listen on 0.0.0.0 instead of using Cloud Proxy. Cloud proxy is inefficient as it adds an extra network hop and extra fragility to your network conn.
Same issue here. I want to test locally an app A that makes requests to an app B that’s hosted on Cloud Run. Because is B is not publicly accessible, gcloud proxy is needed to be able to access app B locally. However gcloud proxy listens to localhost only, which means it’s not directly accessible to a Docker container running the app A.
I was able to workaround it with another proxy:
# Start Cloud Run proxy on port 8001
gcloud run services proxy <name> --port=8001
# Listen to requests on 0.0.0.0:8000 and proxy them to 127.0.0.1:8001
socat TCP-LISTEN:8000,fork TCP:127.0.0.1:8001
It works, but it’s cumbersome. Ideally, the gcloud run services proxy command should have an “address” flag to allow specifying the bind address.