def dangling(prune=False, force=False):
 all_images = images(all=True)
 dangling_images = [x[:12] for x in _get_top_level_images(all_images) if (all_images[x]['RepoTags'] is None)]
 if (not prune):
  return dangling_images
 ret = {}
 for image in dangling_images:
  try:
   ret.setdefault(image, {})['Removed'] = rmi(image, force=force)
  except Exception as exc:
   err = '{0}'.format(exc)
   log.error(err)
   ret.setdefault(image, {})['Comment'] = err
   ret[image]['Removed'] = False
 return ret

def dangling ( prune = False , force = False ) : all_images = images ( all = True ) dangling_images = [ x [ : 12 ] for x in _get_top_level_images ( all_images ) if ( all_images [ x ] [ 'RepoTags' ] is None ) ] if ( not prune ) : return dangling_images ret = { } for image in dangling_images : try : ret . setdefault ( image , { } ) [ 'Removed' ] = rmi ( image , force = force ) except Exception as exc : err = '{0}' . format ( exc ) log . error ( err ) ret . setdefault ( image , { } ) [ 'Comment' ] = err ret [ image ] [ 'Removed' ] = False return ret
return top-level images which do not have a tag assigned to them .