code: func getImageRef(client libdocker.Interface, image string) (string, error) {
  	img, err := client.InspectImageByRef(image)
  	if err != nil {
  		return "", err
  	}
  	if img == nil {
  		return "", fmt.Errorf("unable to inspect image %s", image)
  	}
  
  	// Returns the digest if it exist.
  	if len(img.RepoDigests) > 0 {
  		return img.RepoDigests[0], nil
  	}
  
  	return img.ID, nil
  }
docs: // getImageRef returns the image digest if exists, or else returns the image ID.