From 7301fbe035ca450e2aea86b8f2467cffd3fac18b Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Tue, 12 Nov 2013 11:48:35 -0800 Subject: [PATCH] Pull parent layers first before children --- server.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server.go b/server.go index 6a94c8ae2c..3d27d50dcc 100644 --- a/server.go +++ b/server.go @@ -537,7 +537,8 @@ func (srv *Server) pullImage(r *registry.Registry, out io.Writer, imgID, endpoin // FIXME: Try to stream the images? // FIXME: Launch the getRemoteImage() in goroutines - for _, id := range history { + for i := len(history) - 1; i >= 0; i-- { + id := history[i] // ensure no two downloads of the same layer happen at the same time if err := srv.poolAdd("pull", "layer:"+id); err != nil {