retry to retrieve layer metadata on failure during pull

This PR is complete and needs review.

This makes `docker pull` retry to retrieve the layer metadata. This is the first step towards making the needed changes to fix #2461.

This requires some more changes, but the code should work properly as it is right now. Please test it and provide feedback.

To do:
- [x] add a delay between retries
- [x] test against the central registry