Ref : https://github.com/python/cpython/pull/25174

https://github.com/localstack/localstack/blob/5a5edcd9d9ccbd6a56f23d71e3a1131b8c814996/localstack/utils/common.py#L324
return bootstrap.get_docker_container_names()
def get_docker_image_names(strip_latest=True):
    cmd = "%s images --format '{{.Repository}}:{{.Tag}}'" % config.DOCKER_CMD
    try:
        output = to_str(run(cmd))
        image_names = re.split(r'\s+', output.strip().replace('\n', ' '))
        if strip_latest:
            suffix = ':latest'
            for image in list(image_names):
                if image.endswith(suffix):
                    image_names.append(image[:-len(suffix)])
        return image_names
    except Exception as e:
        LOG.info('Unable to list Docker images via "%s": %s' % (cmd, e))
        return []
def rm_docker_container(container_name_or_id, check_existence=False, safe=False):
    if not container_name_or_id:
        return
    if check_existence and container_name_or_id not in get_docker_container_names():
        
        return
    try:
        run('%s rm -f %s' % (config.DOCKER_CMD, container_name_or_id), print_error=False)
    except Exception:
        if not safe:
            raise
def path_from_url(url):