builder: Fix CMD to inject /bin/sh -c when provided with a non-json value

closes #8264 

/cc @aanand @tiborvass 
the description of the test reflects only half of the test. You also check for the JSON one. Maybe we should separate it into two tests?