google-cloud-platformgoogle-kubernetes-enginegoogle-container-os

Piping using toolbox in Google Container Optimized OS


I'm trying to create a script that runs on google container optimized os that calls curl using toolbox but I want to pipe the results to jq by doing something like this:

sudo toolbox curl ... | sudo toolbox jq -r ".something"

but if I do this I get this error message:

Directory tree /var/lib/toolbox/root-gcr.io_google-containers_toolbox-20161110-02 is currently busy.

If I remove toolbox from the pipe (and just pipe to a command like grep that exists in the container) then everything works. But how can I pipe from curl to jq using toolbox?


Solution

  • I solved this by doing:

    sudo toolbox bash -c 'curl ... | jq -r ".something"'