How to determine the assigned IPv4 inside a container deployed to Fly

I have a Kubo container deployed to that has been assigned the following IPv4:

How can I find out what the public IPv4 is from within the container?

Some approaches I looked at:

  • The FLY_PUBLIC_IP env var, but it’s pointing to the IPv6.
  • Making an HTTP call to
  • Relying on libp2p AutoNAT in order to get the publicly visible IPv4.

The last two approaches consistently return a different IP from the one assigned which is interesting (

Are there any other approaches? What would you recommend?

Lookup <appname> for A records?

Note though, while each VM gets a unique IPv6 (FLY_PUBLIC_IP), the app as a whole (ie, all VMs of the app) gets the assigned shared / dedicated IPv4s.