def cleanup_containers(**kwargs):
    """
    Removes all containers that have finished running. Similar to the ``prune`` functionality in newer Docker versions.
    """
    containers = docker_fabric().cleanup_containers(**kwargs)
    if kwargs.get('list_only'):
        puts('Existing containers:')
        for c_id, c_name in containers:
            fastprint('{0}  {1}'.format(c_id, c_name), end='\n')
Removes all containers that have finished running. Similar to the ``prune`` functionality in newer Docker versions.