code: func PullImage(ctx context.Context, client client.ImageAPIClient, serviceName string, authLookup auth.Lookup, image string) error {
  	fmt.Fprintf(os.Stderr, "Pulling %s (%s)...\n", serviceName, image)
  	distributionRef, err := reference.ParseNormalizedNamed(image)
  	if err != nil {
  		return err
  	}
  
  	repoInfo, err := registry.ParseRepositoryInfo(distributionRef)
  	if err != nil {
  		return err
  	}
  
  	authConfig := authLookup.Lookup(repoInfo)
  
  	// Use ConfigFile.SaveToWriter to not re-define encodeAuthToBase64
  	encodedAuth, err := encodeAuthToBase64(authConfig)
  	if err != nil {
  		return err
  	}
  
  	options := types.ImagePullOptions{
  		RegistryAuth: encodedAuth,
  	}
  	responseBody, err := client.ImagePull(ctx, distributionRef.String(), options)
  	if err != nil {
  		logrus.Errorf("Failed to pull image %s: %v", image, err)
  		return err
  	}
  	defer responseBody.Close()
  
  	var writeBuff io.Writer = os.Stderr
  
  	outFd, isTerminalOut := term.GetFdInfo(os.Stderr)
  
  	err = jsonmessage.DisplayJSONMessagesStream(responseBody, writeBuff, outFd, isTerminalOut, nil)
  	if err != nil {
  		if jerr, ok := err.(*jsonmessage.JSONError); ok {
  			// If no error code is set, default to 1
  			if jerr.Code == 0 {
  				jerr.Code = 1
  			}
  			fmt.Fprintf(os.Stderr, "%s", writeBuff)
  			return fmt.Errorf("Status: %s, Code: %d", jerr.Message, jerr.Code)
  		}
  	}
  	return err
  }
docs: // PullImage pulls the specified image (can be a name, an id or a digest)
  // to the daemon store with the specified client.