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?
- Run
cf ssh dorato begin a secure connection to the SSH server for your app. - Run
ls -lto view files andcd SOME-DIRECTORY-PATHto move around the directory tree. - Use the
ps auxcommand to see what processes are running in the app container. - Run
envto 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. - Run
exit, then SSH back into a specific instance of your app, using the-i SOME-APP-INDEXflag (when you runcf app dorayou’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
Docs: Differences Between DEA and Diego Architectures
Blog post: Demystifying Cloud Foundry’s Diego
Unix/Linux StackExchange: What does aux mean in ps aux?