Re: How to get the IP addresses of the instances of the same application

Casey West

Indeed, I've had great success using the `jq` command-line tool to parse
JSON along with `cf app app-name --guid` and `cf curl`. Like so:

$ cf curl /v2/apps/$(cf app app-name --guid)/stats | jq '.[]'

More on jq if needed:

— Casey

On Sat, Mar 5, 2016 at 8:15 PM DHR <lists(a)> wrote:

The router_status endpoint of the router node gives a nice point-in-time
snapshot of the IPs / ports in is for each app URL, in json, andis
continually kept up to date by the CF platform.

On 4 Mar 2016, at 22:31, Jason Sherron <jsherron(a)> wrote:

I'm also very interested to hear about what you might need to do with
direct container-to-container communication. We've started an effort to
enable it at the network layer, and as Dan gets at, service discovery is a
thorny area, and we'd like to hear your feedback.

On Fri, Mar 4, 2016 at 9:07 AM, Daniel Mikusa <dmikusa(a)> wrote:

On Thu, Mar 3, 2016 at 10:32 PM, Malmee Weerasinghe <malmee(a)>

When I push an application to cloud foundry, "cf scale myApp -i 5" will
increase the number of instances of my application to 5. I want to get the
ip addresses of these instances. Is there any way to get the ip addresses
and ports of the 5 instances of my application? Is there any API?
Look at the environment variables in the container, things starting with
VCAP_ or CF_ provide you with details about the container, app and bound
services. It sounds like you're looking for CF_INSTANCE_ADDR in particular.

That said, what are you planning to do with this information? You don't
really want to try and talk directly to specific app instances. Those
instance can come and go and the IP's can change. If you're talking
directly then you have the tedious task of tracking all that information.
If instead you talk through the URL mapped to your app then you never have
to worry about things changing.

It's probably also worth mentioning that some CF installations will
prohibit direct container to container communication.


I am running cloud foundry with diego in bosh-lite. In documents I have
seen that garden API gives container information, but how to call the
garden API? I highly appreciate your responses regarding this issue.

Thank you.

Join to automatically receive all group messages.