code: func pullImage(ctx context.Context, node *types.Node, image string) error {
  	log.Infof("[pullImage] Pulling image %s", image)
  	if image == "" {
  		return types.ErrNoImage
  	}
  
  	// check local
  	exists := false
  	digests, err := node.Engine.ImageLocalDigests(ctx, image)
  	if err != nil {
  		log.Errorf("[pullImage] Check image failed %v", err)
  	} else {
  		log.Debug("[pullImage] Local Image exists")
  		exists = true
  	}
  
  	if exists && distributionInspect(ctx, node, image, digests) {
  		log.Debug("[pullImage] Image cached, skip pulling")
  		return nil
  	}
  
  	log.Info("[pullImage] Image not cached, pulling")
  	outStream, err := node.Engine.ImagePull(ctx, image, false)
  	if err != nil {
  		log.Errorf("[pullImage] Error during pulling image %s: %v", image, err)
  		return err
  	}
  	ensureReaderClosed(outStream)
  	log.Infof("[pullImage] Done pulling image %s", image)
  	return nil
  }
docs: // Pull an image