Browse code

Pull parent layers first before children

Michael Crosby authored on 2013/11/13 04:48:35
Showing 1 changed files
... ...
@@ -537,7 +537,8 @@ func (srv *Server) pullImage(r *registry.Registry, out io.Writer, imgID, endpoin
537 537
 	// FIXME: Try to stream the images?
538 538
 	// FIXME: Launch the getRemoteImage() in goroutines
539 539
 
540
-	for _, id := range history {
540
+	for i := len(history) - 1; i >= 0; i-- {
541
+		id := history[i]
541 542
 
542 543
 		// ensure no two downloads of the same layer happen at the same time
543 544
 		if err := srv.poolAdd("pull", "layer:"+id); err != nil {