Stopping and Deleting Apps

This topic explains how to stop and delete apps.

To run the commands in this topic, you must first install the Cloud Foundry Command Line Interface (cf CLI). See the Cloud Foundry Command Line Interface topics for more information.

Stop and Start an App

You can stop an app for many reasons. For example, stopping an app frees the memory from your quota.

To stop an app, run cf stop APP-NAME. Replace APP-NAME with the name of the app you want to stop.

Example:

$ cf stop my-example-app

Running this commands stops the app, but databases and other provisioned services still run and consume resources. Users visiting the URL of a stopped app see a 404 error message like the following:

404 Not Found: Requested route ('my-example-app.example.com') does not exist.

To start an app, run cf start APP-NAME. Replace APP-NAME with the name of the app you want to stop.

Example:

$ cf start my-example-app

Delete an App

Note: Deleting an app is irreversible. We strongly recommend running that you run cf target before you start to confirm you are deleting the app from the correct org and space.

Many apps use services and routes. Deleting an app does not delete the services used by the app, and you must explicitly remove routes between your app and the Internet.

Delete an App with Services

To delete an app with the services you have provisioned for it, delete the services first.

  1. Run cf services to view all active services in the current space.

  2. Examine the list to determine which services are bound to your app. Record the name of the service instance bound to the app. If the list shows a service instance bound to any apps besides the app you want to delete, do not delete the service instance. If you delete a service instance bound to more than one app, you deletes the service instance from all of those apps.

  3. Run cf delete-service SERVICE-INSTANCE to delete the service instance. Replace SERVICE-INSTANCE with the name of the service instance bound to your app.

Example:

$ cf delete-service my-example-service-instance

Delete an App with No Services

To delete an app with no services, run cf delete -r APP-NAME. Replace APP-NAME with the name of the app. The -r option instructs the cf CLI to removes routes associated with the app.

Example:

$ cf delete -r my-example-app

If you delete an app without the r option, you can delete the route manually.

Follow the steps below to delete the route for an app manually.

  1. Run cf routes to confirm the details of the orphaned route. The cf routes command returns a list of all active routes in the current space. This list includes the space, hostname, domain, port, path, type, and any bound apps or services.

  2. Find the orphaned route in the list. The orphaned route displays as a hostname without an associated app.

  3. Run cf delete-route DOMAIN-NAME --hostname HOSTNAME to delete the orphaned route. Replace DOMAIN-NAME and HOSTNAME with the domain and hostname of the app you deleted.

Example:

$ cf delete-route my-domain.com --hostname my-example-app

Create a pull request or raise an issue on the source for this page in GitHub