Binary Buildpack

Page last updated:

Use the binary buildpack for running arbitrary binary web servers.

Push an App

Specify the binary buildpack to stage an app as a binary file. On a command line, use cf push APP-NAME with the -b option to specify the buildpack.

For example:

$ cf push my_app -b

You can provide Cloud Foundry with the shell command to execute your binary in the following two ways:

  • Procfile: In the root directory of your app, add a Procfile that specifies a web task:

    web: ./app
  • Command line: Use cf push APP-NAME with the -c option:

    $ cf push my_app -c './app' -b binary_buildpack

Compile your Binary

Cloud Foundry expects your binary to bind to the port specified by the PORT environment variable.

The following example in Go binds a binary to the PORT environment variable:

package main

import (

func handler(w http.ResponseWriter, r *http.Request) {
    fmt.Fprintf(w, "Hello, %s", "world!")

func main() {
    http.HandleFunc("/", handler)
    http.ListenAndServe(":"+os.Getenv("PORT"), nil)

Your binary should run without any additional runtime dependencies on the cflinuxfs3 or lucid64 root filesystem (rootfs). Any such dependencies should be statically linked to the binary.

To boot a Docker container running the cflinuxfs3 filesystem, run the following command:

$ docker run -it cloudfoundry/cflinuxfs3 bash

To boot a Docker container running the lucid64 filesystem, run the following command:

$ docker run -it cloudfoundry/lucid64 bash

To compile the above Go application on the rootfs, golang must be installed. apt-get install golang and go build app.go will produce an app binary.

When deploying your binary to Cloud Foundry, use cf push with the -s option to specify the root filesystem it should run against.

$ cf push my_app -s (cflinuxfs3|lucid64)

BOSH Configured Custom Trusted Certificate Support

Your platform operator can configure the platform to add the custom certificates into the application container. The custom trusted certificates are added to the /etc/ssl/certs directory and can be used by binary applications.

For more information, see Configuring Trusted System Certificates for Applications.

.NET Apps

You can use the Binary buildpack to push .NET Core apps, .NET Console apps, and self-hosted apps to the Windows stack. Self-hosted apps are apps that include their own web server.

To push a .NET Console app using the binary buildpack, see Console Applications in the .NET Cookbook for more information.

To deploy .NET Core apps to Windows using the binary buildpack, build it as a self-hosted app and push it with the binary buildpack. Note that you will need to specify the windows2016 stack and use a custom start command in your manifest file. Here is an example manifest:

- name: mydemoapp
  random-route: true
  stack: windows2016
  health-check-type: none
  command: cmd /c .\CloudFoundry --server.urls http://*:%PORT%

For information about deploying different types of .NET apps, follow the links in the table below.

Type of .NET App Buildpack
ASP.NET Web Forms
Windows Communication Foundation (WCF)
.NET Core pushed to Linux stack .NET Core

Help and Support

Join the #buildpacks channel in our Slack community if you need any further assistance.

For more information about using and extending the binary buildpack in Cloud Foundry, see the binary-buildpack GitHub repository.

You can find current information about this buildpack on the binary buildpack release page in GitHub.

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