SSH into a running app container
What?
Your applications run on Diego Cells, which create containers for each of your application instances. One of the features of Diego (the new CF Runtime) versus DEAs (the original Runtime) is that you have the ability to SSH into the containers for debugging purposes.
How?
cf ssh dora
ls
around the directory tree- Use the
ps aux
command to see what processes are running. - Run
env
to view environment variables. You’ll see there are additional environment variables that the cf CLI doesn’t print, but that are available to your application. The full list of variables can be viewed here. exit
, then SSH back into a specific instance of your app, using the-i app-instance-index
flag (when you runcf app app-name
you’ll see the indexes of the instances displayed in turquoise to the left of their information). View the cf CLI SSH flags to see what else is possible.
TRIVIA: did you notice that you’re SSH-ed in as the vcap
user? VCAP stands for “VMware’s Cloud Application Platform,” an old name for Cloud Foundry. Catchy, right?
Resources
Differences Between DEA and Diego Architectures
Demystifying Cloud Foundry’s Diego
Unix/Linux StackExchange: What does aux mean in ps aux
?