github.com/AbhinandanKurakure/podman/v3@v3.4.10/test/python/docker/compat/common.py (about)

     1  from docker import DockerClient
     2  
     3  from test.python.docker.compat import constant
     4  
     5  
     6  def run_top_container(client: DockerClient):
     7      c = client.containers.create(
     8          constant.ALPINE, command="top", detach=True, tty=True, name="top"
     9      )
    10      c.start()
    11      return c.id
    12  
    13  
    14  def remove_all_containers(client: DockerClient):
    15      for ctnr in client.containers.list(all=True):
    16          ctnr.remove(force=True)
    17  
    18  
    19  def remove_all_images(client: DockerClient):
    20      for img in client.images.list():
    21          # FIXME should DELETE /images accept the sha256: prefix?
    22          id_ = img.id.removeprefix("sha256:")
    23          client.images.remove(id_, force=True)