Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions tools/cleanup_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ def inspect(name):


def identity(info):
return {key: info[key] for key in ("Id", "Created", "Image", "Config", "Mounts")} | {
"state": {key: info["State"][key] for key in ("Status", "Running", "StartedAt", "FinishedAt")}
# Docker reports Mounts in no fixed order; sort by destination (unique per
# container) so the same container compares equal across inspects.
mounts = sorted(info["Mounts"], key=lambda mount: mount["Destination"])
return {key: info[key] for key in ("Id", "Created", "Image", "Config")} | {
"Mounts": mounts,
"state": {key: info["State"][key] for key in ("Status", "Running", "StartedAt", "FinishedAt")},
}


Expand Down