When pushing the app to Pivotal CF or Pivotal Web Services (PWS) without specifying buildpack, it fails with the following error:
Starting app myapp in org my org / space myspace as username... Downloading binary_buildpack... Downloading staticfile_buildpack... Downloading java_buildpack... Downloading nodejs_buildpack... Downloading go_buildpack... Downloaded go_buildpack Downloading python_buildpack... Downloaded nodejs_buildpack Downloading php_buildpack... Downloaded java_buildpack Downloading liberty_buildpack... Downloaded binary_buildpack Downloading ruby_buildpack... Downloaded ruby_buildpack Downloaded php_buildpack Downloaded liberty_buildpack Downloaded python_buildpack Downloaded staticfile_buildpack Creating container Successfully created container Downloading app package... Downloaded app package (3.7K) Staging... None of the buildpacks detected a compatible application Exit status 222 Staging failed: Exited with status 222 Destroying container Successfully destroyed container FAILED Error restarting application: NoAppDetectedError TIP: Buildpacks are detected when the "cf push" is executed from within the directory that contains the app source code. Use 'cf buildpacks' to see a list of supported buildpacks. Use 'cf logs nitindemo --recent' for more in depth log information.
When pushing an app, Cloud Foundry determines which buildpack to use by running each enabled buildpacks’ detect script (bin/detect
) during staging.
Each buildpack has a position in a priority list (identified by running cf buildpacks
). Cloud Foundry checks if the buildpack in position 1 is a compatible buildpack. If the position 1 buildpack is not compatible, Cloud Foundry moves on to the next buildpack. Cloud Foundry continues this process until the correct buildpack is found. This script takes app's root directory (in case of Java app, it's jar
or war
file) as a single argument and must return an exit code of 0 if the app present at the directory can be serviced by this buildpack.
(Ruby buildpack bin/detect
script example)
#!/bin/bash if [ -f "$1/Gemfile" ]; then SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" echo "ruby $(cat $SCRIPT_DIR/../VERSION)" exit 0 else echo "no" exit 1 fi
If no buildpack is compatible, cf push
fails with the following error:
None of the buildpacks detected a compatible application Exit status 222 Staging failed: Exited with status 222 Destroying container Successfully destroyed container FAILED Error restarting application: NoAppDetectedError
Follow the steps to resolve this issue:
cf push -p
option or path
entry in deployment manifest. For Java app, it must be pointed to a valid jar or war file, if using an executable jar, a main-class needs to be specified in config/java_main.yml
. For Non-Java apps, it must be pointed to app root directory. binary_buildpack
with cf push -b
option or buildpack entry in deployment manifest.