code: func (imageManager *dockerImageManager) RecordContainerReference(container *apicontainer.Container) error {
  	// the image state has been updated, save the new state
  	defer imageManager.saver.ForceSave()
  	// On agent restart, container ID was retrieved from agent state file
  	// TODO add setter and getter for modifying this
  	if container.ImageID != "" {
  		if !imageManager.addContainerReferenceToExistingImageState(container) {
  			return fmt.Errorf("Failed to add container to existing image state")
  		}
  		return nil
  	}
  
  	if container.Image == "" {
  		return fmt.Errorf("Invalid container reference: Empty image name")
  	}
  
  	// Inspect image for obtaining Container's Image ID
  	imageInspected, err := imageManager.client.InspectImage(container.Image)
  	if err != nil {
  		seelog.Errorf("Error inspecting image %v: %v", container.Image, err)
  		return err
  	}
  
  	container.ImageID = imageInspected.ID
  	added := imageManager.addContainerReferenceToExistingImageState(container)
  	if !added {
  		imageManager.addContainerReferenceToNewImageState(container, imageInspected.Size)
  	}
  	return nil
  }
docs: // RecordContainerReference adds container reference to the corresponding imageState object