code: def delete_image(name: str, remote: bool = True):
      """Delete container image in local and remote registry."""
      client = docker.from_env()
  
      # List all images including un-tagged images and delete all of them.
      images = client.images.list(name)
      # Sort list to delete children images first.
      images.sort(
          key=lambda image: image.attrs["Created"], reverse=True
      )
      for image in images:
          client.images.remove(image.id, force=True)
          if remote:
              # NOTE: RepoDigest != id. Use repo digests when deleting remote images.
              remote_image = image.attrs["RepoDigests"][0]
              subprocess.check_output(
                  [
                      "gcloud",
                      "container",
                      "images",
                      "delete",
                      remote_image,
                      "--quiet",
                      "--force-delete-tags",
                  ]
              )
      client.close()
  
label_desc: Use image node_id 1 for calling a global function with example usage: delete_image(name, remote) without return types