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: Woo Huiren

Currently a student at National University of Singapore. I contribute to opensource projects - primarily PHP and Angular related. I write about PCF and PWS related stuff too.

Leave a Reply