Cloudfoundry SSH with environment

The default cf ssh without parameters allows users to access their containers or virtual machine just fine. However, there are limitations to this.

In PHP buildpacks, the default SSH will not load dynamic libraries such as curl. The following commands will resolve this issue by loading the environment into the bash command.

For cf ssh:

cf ssh "<app-name>" -t -c "/tmp/lifecycle/launcher /home/vcap/app bash ''"

For cf v3-ssh (apps deployed using v3-push):

cf v3-ssh "<app-name>" -t -c "/tmp/lifecycle/launcher /home/vcap/app bash ''"

As a reminder, changing contents within the container or virtual machine does not persist. Hence, making persistent changes through SSH is not recommended.

Author: Huiren

I use free software and sometimes contribute to free software. I write about mostly technical problems I face and how I overcome them

Leave a Reply