- Pivotal Cloud Foundry® (PCF) version 1.6 and above
- All Operating Systems
Cloud Foundry provides the official command line client cf cli (link) for Single SHell (SSH) logon to application containers or invoking commands inside of containers.
cf ssh APP_NAME [-i app-instance-index] [-c command] [-L [bind_address:]port:host:hostport] [--skip-host-validation] [--skip-remote-execution] [--request-pseudo-tty] [--force-pseudo-tty] [--disable-pseudo-tty]
However, in case of network issues, configuration mistakes or other temporary issues, "cf ssh" fails and it only returns a limited error message as shown below:
Error opening SSH connection: dial tcp <load balancer IP>:2222: connectex: No connection could be made because the target machine actively refused it.
This article discusses how to enable SSH verbose mode when accessing application containers for troubleshooting purpose.
Follow the steps to resolve this issue:
- Retrieve one-time passcode by executing "cf ssh-code".
- Retrieve application guid by executing "cf app APP_NAME --guid", replace APP_NAME with your own app name.
- SSHlogon with "-vv" options appended, please replace APP_GUID and system domain with actual string:
ssh -vv -p 2222 cf:<APP_GUID>/0@ssh.<system domain>
- Input passcode retrieved at step 1 when prompted.
- If you are not able to resolve the problem, please don't hesitate to contact Pivotal Support for assistance with the output of step 3.
cf cli doesn't provide the "scp" option, which can also be implemented in a similar way by executing "scp" directly. This is an example to copy files from container to localhost.
scp -P 2222 -o User=cf:<APP_GUID>/0 ssh.<system domain>:/<path>/<file name> ./