I have a Cloud Foundry Bosh Lite install with Garden/Runc support running on my local dev machine with an app hosted on it. I can ssh into the Diego cell VM and execute
cell_z1/0# runc exec 5f9c8b67-9170-4c53-4bab-bbb2e6a3acdf /usr/bin/printenv
This will produce the following output:
INSTANCE_GUID=5f9c8b67-9170-4c53-4bab-bbb2e6a3acdf
INSTANCE_INDEX=0
CF_INSTANCE_GUID=5f9c8b67-9170-4c53-4bab-bbb2e6a3acdf
CF_INSTANCE_INDEX=0
LANG=en_US.UTF-8
CF_INSTANCE_CERT=/etc/cf-instance-credentials/instance.crt
CF_INSTANCE_KEY=/etc/cf-instance-credentials/instance.key
HOME=/root
I assumed I could achieve the same through the Garden API by invoking
cell_z1/0# curl -X POST -d '{"path":"/usr/bin/printenv"}' localhost:7777/containers/5f9c8b67-9170-4c53-4bab-bbb2e6a3acdf/processes
However, this will return
{"Type":"","Message":"EOF","Handle":""}
which unfortunately tells me nothing. I tried adding "user":"vcap"
in the JSON payload but the result is the same. When I add -H "Content-Type: application/json" -d
I get
curl: (56) Problem (2) in the Chunked-Encoded data
Question: how can I execute an arbitrary command inside a container via the Garden API and retrieve it's output?