Implement BuildImage cancellation (incomplete)

This prototypes BuildImage cancellation.

It's split into three commits which should make the implementation clear.

Unfortunately it doesn't work for now until docker itself implements cancellation.

I've supplied this pull request to document the mechanics of this since I had already done a fair amount of the implementation on the assumption it would work before discovering that docker itself doesn't support it.

Therefore, I will immediately close this pull request and hopefully we can reopen it and revisit it in the future.