docs: def build_image_list(config, image, imagefile, all_local, include_allanchore, dockerfile=None, exclude_file=None):
      """Given option inputs from the cli, construct a list of image ids. Includes all found with no exclusion logic"""
  
      if not image and not (imagefile or all_local):
          raise click.BadOptionUsage('No input found for image source. One of <image>, <imagefile>, or <all> must be specified')
  
      if image and imagefile:
          raise click.BadOptionUsage('Only one of <image> and <imagefile> can be specified')
  
      filter_images = []
      if exclude_file:
          with open(exclude_file) as f:
              for line in f.readlines():
                  filter_images.append(line.strip())
  
      imagelist = {}
      if image:
          imagelist[image] = {'dockerfile':dockerfile}
  
      if imagefile:
          filelist = anchore_utils.read_kvfile_tolist(imagefile)
          for i in range(len(filelist)):
              l = filelist[i]
              imageId = l[0]
              try:
                  dfile = l[1]
              except:
                  dfile = None
              imagelist[imageId] = {'dockerfile':dfile}
  
      if all_local:
          docker_cli = contexts['docker_cli']
          if docker_cli:
              for f in docker_cli.images(all=True, quiet=True, filters={'dangling': False}):
                  if f not in imagelist and f not in filter_images:
                      imagelist[f] = {'dockerfile':None}
          else:
              raise Exception("Could not load any images from local docker host - is docker running?")
  
      if include_allanchore:
          ret = contexts['anchore_db'].load_all_images().keys()
          if ret and len(ret) > 0:
              for l in list(set(imagelist.keys()) | set(ret)):
                  imagelist[l] = {'dockerfile':None}
  
      # Remove excluded items
      for excluded in filter_images:
          docker_cli = contexts['docker_cli']
          if not docker_cli:
              raise Exception("Could not query docker - is docker running?")
          for img in docker_cli.images(name=excluded, quiet=True):
              imagelist.pop(img, None)
  
      return imagelist