Based on #12874 from Sam Abed <sam.abed@gmail.com>. His original commit was brought up to date by manually porting the changes in pull.go into the new code in pull_v1.go and pull_v2.go. Fixes #8385 Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com> Upstream-commit: 572f008e892b06262963ccb75c631f2f5d6c6fcd Component: engine