Skip to Content
Technical Articles
Author's profile photo Remi ASTIER

Recover the source code of a running HDI container or Cloud Foundry application

You might be in a situation where a colleague has published an application and has not committed the source in a repository so it’s running all right, but you might not know exactly what’s running 🙂

Here’s one way to solve the issue:
Start by logging into cloud foundry using the command line.

cf login --sso
API endpoint:
Temporary Authentication Code ( Get one at ):

Then navigate to the cloud foundry target organization and space using cf target
Locate the application or hdi container for which you’d like the source code and execute:

cf app your_app_name --guid

Finally, use the guid of your application to download the sources into a .tgz

cf curl -X GET /v2/apps/your_app_guid/download --output your_app_name.droplet.tgz

And voila ! The tgz will contain the source code and possibly dependent libraries so you might want to delete the dependency folder such as node_modules.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Alex Dalentzas
      Alex Dalentzas

      Very handy! Thanks for sharing Remi.

      Author's profile photo Cedric Heisel
      Cedric Heisel

      And last but not least:
      If you did find yourself in this position and you did fetch your application back from CF by using this approach, you really should think about a working CI/CD strategy for your needs!!! 😉

      Anyway - Thx for this information Remi ASTIER !