Managing Custom Buildpacks

Page last updated:

This topic describes how an administrator can manage additional buildpacks in Cloud Foundry Cloud Foundry) using the Cloud Foundry Command Line Interface tool (cf CLI). If your app uses a language or framework that the Cloud Foundry system buildpacks do not support, you can take one of the following actions:

Add a Buildpack

Note: You must be a Cloud Foundry admin user to run the commands discussed in this section.

To add a buildpack:

  1. Run:

    cf create-buildpack BUILDPACK PATH POSITION
    

    Where:

    • BUILDPACK specifies the buildpack name.
    • PATH specifies the location of the buildpack. PATH can point to a ZIP file, the URL of a ZIP file, or a local directory.
    • POSITION specifies where to place the buildpack in the detection priority list.

    For more information, see create-buildpack in the Cloud Foundry CLI Reference Guide.

  2. To confirm that you have successfully added a buildpack, run:

    cf buildpacks
    

Rename a Buildpack

To rename a buildpack:

  • If you use cf CLI v7 or cf CLIv8 run:

    cf update-buildpack --rename BUILDPACK-NAME NEW-BUILDPACK-NAME
    

    Where:

    • BUILDPACK-NAME is the original buildpack name.
    • NEW-BUILDPACK-NAME is the new buildpack name.

For more information about renaming buildpacks, see rename-buildpack in the Cloud Foundry CLI Reference Guide.

Update a Buildpack

To update a buildpack, run:

cf update-buildpack BUILDPACK [-p PATH] [-i POSITION] [-s STACK][--enable|--disable] [--lock|--unlock]

Where:

  • BUILDPACK is the buildpack name.
  • PATH is the location of the buildpack.
  • POSITION is where the buildpack is in the detection priority list.
  • STACK is the stack that the buildpack uses.

Note: cf CLI v7 removes the cf rename-buildpack command in favor of a --rename option for cf update-buildpack.

For more information about updating buildpacks, see update buildpack in the Cloud Foundry CLI Reference Guide.

Delete a Buildpack

To delete a buildpack, run:

cf delete-buildpack BUILDPACK [-s STACK] [-f]

Where:

  • BUILDPACK is the buildpack name.
  • STACK is the stack that the buildpack uses.

For more information about deleting buildpacks, see delete-buildpack in the Cloud Foundry CLI Reference Guide.

Lock and Unlock a Buildpack

Every new version of Cloud Foundry ships with an updated buildpack. By default, your deployment applies the most recent buildpack when you upgrade. In some cases, however, you might want to preserve an existing buildpack, rather than upgrade to the latest version. For example, if an app you deploy depends on a specific component in Buildpack A that is not available in Buildpack B, you might want to continue using Buildpack A.

The --lock flag lets you continue to use your existing buildpack even after you upgrade. Locked buildpacks are not updated when Cloud Foundry updates. You must manually unlock them to update them.

If you elect to use the --unlock flag, your deployment applies to the most recent buildpack when you upgrade Cloud Foundry.

cf update-buildpack BUILDPACK [-p PATH] [-i POSITION] [-s STACK] [--enable|--disable] [--lock|--unlock]

Note: cf CLI v7 removes cf rename-buildpack in favor of a --rename flag for cf update-buildpack.

This feature is also available through the API. See Lock or unlock a Buildpack in the Cloud Foundry API documentation.

Deactivate Custom Buildpacks

You can disable custom buildpacks for an entire deployment by adding disable_custom_buildpacks: true in your Cloud Foundry manifest under properties.cc.

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