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> [<options>] [<arguments>]

PARAMETERS

-v, --verbose
    Enable verbose output

-V, --version
    Display cf CLI version

--help, -h
    Show help information

--no-color
    Disable colored output

--color
    Force colored output

--locale <LOCALE>
    Set locale (e.g., en_US)

--sso
    Use single sign-on for login

--sso-passcode <PASSCODE>
    SSO passcode for login

--trace
    Trace all network calls

--url-timeout <TIMEOUT>
    Max time to wait for server response (seconds)

-r, --randomize
    Randomize query results

--json
    Format output as JSON

DESCRIPTION

The cf command is the official command-line interface (CLI) for Cloud Foundry (CF), an open-source platform-as-a-service (PaaS) for deploying, scaling, and managing cloud-native applications.

Cloud Foundry supports multiple languages and frameworks, allowing developers to push apps with cf push, manage services, routes, and organizations/spaces. It interacts with CF API endpoints to perform operations like authentication (cf login), targeting org/space (cf target), listing apps (cf apps), viewing logs (cf logs), and scaling instances.

The CLI is plugin-extensible, supports streaming logs in real-time, and provides features like blue-green deployments via zero-downtime pushes. It's widely used in enterprise environments for microservices orchestration on public or private CF installations like PCF or OSS CF.

Installation is via package managers (e.g., apt, brew) or binaries. Users must login to a CF foundation and set API targets before use. Output is colorized by default for readability.

CAVEATS

Not a core Linux utility; requires separate installation. Must configure API endpoint and authenticate via cf login before use. Subcommands have their own man pages (e.g., cf-push(1)). Large outputs may require pagination tools.

COMMON WORKFLOW

cf logincf target -o ORG -s SPACEcf pushcf appscf logs APP

INSTALLATION

Linux: sudo apt install cf-cli or download from github.com/cloudfoundry/cli. Verify with cf --version.

PLUGINS

Extend with cf install-plugin PLUGIN, e.g., cf-plugin-autosleep.

HISTORY

Originated in 2011 from VMWare's Cloud Foundry project, initially private PaaS. Became open-source in 2011 under Apache 2.0. CLI (cf) evolved from v6 (2014) to v7+ with modern Go rewrite, supporting CF 2.x/3.x. Maintained by Cloud Foundry Foundation.

SEE ALSO

cf-push(1), cf-login(1), cf-target(1), cf-apps(1), kubectl(1)

Copied to clipboard