buffer layer to disk before registering in graph

This WIP PR makes Docker buffer layers to disk before registering them. This helps speed up the layer download.

Please note that this PR doesn't attempt to do anything about the performance of layer loading. That might still be slow. Registering layers in the graph can still take a long time if the system's performance and disk IO isn't that good.

If this proves to improve performance for some, a flag to bypass the buffering to disk should be added.

The code of the TempFileReader can probably be moved elsewhere.

helps with #7291 by improving pull
I kinda prefer the explicit one.