Use api for pulling images instead of shelling out

I've just copied the functions to parse and validate the repo name from Docker because otherwise this would require including the complete Docker sources.

This closes #167
/cc @brendandburns