LinuxCommandLibrary

cf

Push applications to Cloud Foundry

TLDR

Log in to the Cloud Foundry API

$ cf login -a [api_url]
copy

Push an app using the default settings
$ cf push [app_name]
copy

View the services available from your organization
$ cf marketplace
copy

Create a service instance
$ cf create-service [service] [plan] [service_name]
copy

Connect an application to a service
$ cf bind-service [app_name] [service_name]
copy

Run a script whose code is included in the app, but runs independently
$ cf run-task [app_name] "[script_command]" --name [task_name]
copy

Start an interactive SSH session with a VM hosting an app
$ cf ssh [app_name]
copy

View a dump of recent app logs
$ cf logs [app_name] --recent
copy

SYNOPSIS


cf [global-options] COMMAND [arguments] [command-options]

This synopsis illustrates the general structure. The cf command is followed by optional global-options that affect the CLI's behavior across all commands. A specific COMMAND (e.g., login, push, apps) is then invoked, often accompanied by arguments (like an application name or service name) and command-options specific to that particular command.

PARAMETERS

--version, -v
    Displays the CLI version.

--help, -h
    Displays help for the global CLI or a specific command.

--trace, -t
    Shows API request and response details for debugging.

--debug
    Enables verbose logging, including API details and command execution flow.

DESCRIPTION

The cf command is the Cloud Foundry Command Line Interface (CLI), an essential tool for interacting with Cloud Foundry instances. Cloud Foundry is an open-source, multi-cloud Application Platform as a Service (PaaS) that enables developers to build, deploy, run, and scale applications without managing underlying infrastructure. The cf CLI provides a unified interface to perform various operations, including deploying applications from source code or Docker images, managing service instances (databases, message queues, etc.), binding services to applications, scaling applications, viewing logs, managing organizations and spaces, and handling user permissions. It acts as the primary user interface to a Cloud Foundry deployment, abstracting complex cloud operations into simple, developer-centric commands. While not a core utility included in typical Linux distributions, it is widely used by developers working with Cloud Foundry environments and is installed on Linux systems.

CAVEATS


The cf command is not a standard utility included with most Linux distributions; it must be installed separately. It requires a Cloud Foundry instance (e.g., Cloud.gov, IBM Cloud, SAP BTP, or a self-hosted BOSH deployment) to connect and function. Successful operation depends on proper authentication (using cf login) and continuous network connectivity to the Cloud Foundry API endpoint. The command's functionality is entirely dependent on the availability and configuration of the targeted Cloud Foundry environment.

COMMON COMMANDS

While cf offers numerous commands, some are used frequently:
cf login: Authenticates the CLI with a Cloud Foundry instance.
cf push: Deploys an application to Cloud Foundry.
cf apps: Lists deployed applications.
cf services: Lists provisioned service instances.
cf logs: Streams application logs in real-time.

INSTALLATION

The cf CLI can be installed on Linux via various methods, including package managers (e.g., apt, yum), direct download of binaries from the Cloud Foundry releases page, or using go get if Go is installed. This makes it easily accessible across different Linux distributions.

HISTORY


Cloud Foundry was initially developed by VMware and released as open source in April 2011. Pivotal Software (spun out from EMC/VMware) became the primary commercial entity behind its development. The cf CLI has evolved significantly since its inception, continually adding new features and improving user experience to keep pace with the Cloud Foundry platform's capabilities. In 2015, Cloud Foundry became a Linux Foundation project, fostering broader community collaboration. The CLI is actively maintained, with frequent updates to support new Cloud Foundry features, security patches, and compatibility across various operating systems, reflecting its central role in interacting with the PaaS environment.

SEE ALSO

ssh(1) - For direct shell access to application instances via cf ssh., curl(1) - Represents the underlying HTTP/S communication with the Cloud Foundry API., git(1) - Often used for managing source code that is then pushed to Cloud Foundry., docker - (No man section) For building and managing container images, which cf can deploy., kubectl - (No man section) For managing Kubernetes, a common alternative/complementary container orchestration platform.

Copied to clipboard