Changing stacks

Page last updated:

You can restage apps on a new stack. Here is a description of stacks and lists of stacks that are supported on Cloud Foundry v10-0.

To restage a Windows app on a new Windows stack, see Changing Windows stacks.

You can also use the Stack Auditor plug-in for the Cloud Foundry Command Line Interface (cf CLI) when changing stacks. See Using the Stack Auditor plug-in.

Overview

A stack is a prebuilt root file system (rootfs) that supports a specific operating system. For example, Linux-based systems need /usr and /bin directories at their root. The stack works in tandem with a buildpack to support apps running in compartments. Under Diego architecture, cell VMs can support multiple stacks.

Docker apps do not use stacks.

Available stacks

Cloud Foundry includes support for cflinuxfs4, which is derived from Ubuntu 22.04 LTS (Jammy Jellyfish). For more information, see GitHub cflinuxfs4 stack receipt.

You can also build your own custom stack. For more information, see Adding a Custom Stack.

Stack states

Operators can assign a lifecycle state to each stack. The state affects what operations you can perform with that stack:

State What it means for developers
ACTIVE The stack is fully available. You can push new apps and restage existing apps.
DEPRECATED The stack is still usable, but a warning is shown during cf push and cf restage. Plan to migrate your apps soon.
RESTRICTED You cannot push new apps using this stack. Existing apps can still be restarted and scaled.
DISABLED You cannot stage or restage any app using this stack. Existing apps continue to run and can be restarted and scaled.

When a stack has a state other than ACTIVE, operators typically provide a reason message with migration guidance. This reason is shown in cf stacks, cf stack STACK_NAME, and in any warning or error messages during cf push or cf restage.

If you encounter a restricted or disabled stack, contact your CF operator for migration instructions, or see the reason message provided in the stack details.

Restaging apps on a new stack

For security, stacks receive regular updates to address Common Vulnerabilities and Exposures (CVEs). Apps pick up on these stack changes through new releases of Cloud Foundry. However, if your app links statically to a library provided in the rootfs, you might have to manually restage it to pick up the changes.

It can be difficult to know what libraries an app statically links to, and it depends on the languages you are using. One example is an app that uses a Ruby or Python binary, and links out to part of the C standard library. If the C library requires an update, you might need to recompile the app and restage it.

To restage an app on a new stack:

  1. Use the cf stacks command to list the stacks available in a deployment.

    $ cf stacks
    Getting stacks in org MY-ORG / space development as [email protected]...
    
    name        description                                                    state
    cflinuxfs4  Cloud Foundry Linux-based filesystem (Ubuntu 22.04)            ACTIVE
    cflinuxfs3  Cloud Foundry Linux-based filesystem (Ubuntu 18.04)            DEPRECATED
    

    The state column shows the current lifecycle state of each stack. For stacks in a DEPRECATED, RESTRICTED, or DISABLED state, contact your operator or run cf stack STACK_NAME to view the reason and migration instructions.

  2. To view details and any operator-provided reason for a specific stack, run:

    cf stack STACK_NAME
    

    Example output for a deprecated stack:

    $ cf stack cflinuxfs3
    Getting info for stack cflinuxfs3 as [email protected]...
    
    name:        cflinuxfs3
    description: Cloud Foundry Linux-based filesystem (Ubuntu 18.04)
    state:       DEPRECATED
    reason:      This stack is based on Ubuntu 18.04, which is no longer supported.
                 Please migrate your applications to 'cflinuxfs4'.
                 For more information, see: https://docs.example.com/migrate-stacks.
    

    The reason field is shown only when the state is not ACTIVE.

  3. To change your stack and restage your app, run:

    cf push MY-APP -s STACK-NAME
    

    Where:

    • MY-APP is the name of the app.
    • STACK-NAME is the name of the new stack.

    For example, to restage your app on the stack cflinuxfs4, run cf push MY-APP -s cflinuxfs4:

    $ cf push MY-APP -s cflinuxfs4
    Using stack cflinuxfs4...
    OK
    Creating app MY-APP in org MY-ORG / space development as [email protected]...
    OK
    ...
    requested state: started
    instances: 1/1
    usage: 1G x 1 instances
    urls: MY-APP.cfapps.io
    last uploaded: Wed 17 Jul 22:57:04 UTC 2024
        state     since                  cpu    memory        disk           logging         cpu entitlement   details
    #0  running   2024-07-17T22:57:22Z   0.3%   49.5M of 1G   130.2M of 1G   0B/s of 16K/s   2.4%
    

Stacks API

For API information, see the Stacks section of the Cloud Foundry API Documentation.

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