docker-image-cleanup 0.1.4__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {docker_image_cleanup-0.1.4 → docker_image_cleanup-0.2.0}/PKG-INFO +13 -1
- {docker_image_cleanup-0.1.4 → docker_image_cleanup-0.2.0}/README.md +12 -0
- {docker_image_cleanup-0.1.4 → docker_image_cleanup-0.2.0}/docker_image_cleanup/__init__.py +10 -2
- docker_image_cleanup-0.2.0/pyproject.toml +65 -0
- docker_image_cleanup-0.1.4/pyproject.toml → docker_image_cleanup-0.2.0/pyproject.toml.orig +2 -2
- {docker_image_cleanup-0.1.4 → docker_image_cleanup-0.2.0}/docker_image_cleanup/version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: docker-image-cleanup
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Clean up old Docker images from local storage with retention controls
|
|
5
5
|
Keywords: docker,cleanup,images,disk-space
|
|
6
6
|
Author: Michael Bianco
|
|
@@ -89,6 +89,18 @@ docker run -d \
|
|
|
89
89
|
ghcr.io/iloveitaly/docker-image-cleanup:latest
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
+
Here's an example script to get the latest image and restart any existing docker image:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
docker pull ghcr.io/iloveitaly/docker-image-cleanup:latest
|
|
96
|
+
docker stop docker-image-cleanup && docker rm docker-image-cleanup
|
|
97
|
+
docker run -d \
|
|
98
|
+
--name docker-image-cleanup \
|
|
99
|
+
-v /var/run/docker.sock:/var/run/docker.sock \
|
|
100
|
+
-e TARGET_REPOS="repo.com/one repo.com/two" \
|
|
101
|
+
ghcr.io/iloveitaly/docker-image-cleanup:latest
|
|
102
|
+
```
|
|
103
|
+
|
|
92
104
|
### Docker Compose
|
|
93
105
|
|
|
94
106
|
```yaml
|
|
@@ -73,6 +73,18 @@ docker run -d \
|
|
|
73
73
|
ghcr.io/iloveitaly/docker-image-cleanup:latest
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
+
Here's an example script to get the latest image and restart any existing docker image:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
docker pull ghcr.io/iloveitaly/docker-image-cleanup:latest
|
|
80
|
+
docker stop docker-image-cleanup && docker rm docker-image-cleanup
|
|
81
|
+
docker run -d \
|
|
82
|
+
--name docker-image-cleanup \
|
|
83
|
+
-v /var/run/docker.sock:/var/run/docker.sock \
|
|
84
|
+
-e TARGET_REPOS="repo.com/one repo.com/two" \
|
|
85
|
+
ghcr.io/iloveitaly/docker-image-cleanup:latest
|
|
86
|
+
```
|
|
87
|
+
|
|
76
88
|
### Docker Compose
|
|
77
89
|
|
|
78
90
|
```yaml
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Cleans up old Docker images from local storage with retention controls.
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
+
import sys
|
|
5
6
|
from collections import defaultdict
|
|
6
7
|
from typing import Any
|
|
7
8
|
|
|
@@ -270,6 +271,13 @@ def main(
|
|
|
270
271
|
dry_run=dry_run,
|
|
271
272
|
)
|
|
272
273
|
|
|
274
|
+
log.info(
|
|
275
|
+
"cleanup configuration",
|
|
276
|
+
num_recent=config.num_recent,
|
|
277
|
+
min_age_days=config.min_age_days,
|
|
278
|
+
dry_run=config.dry_run,
|
|
279
|
+
)
|
|
280
|
+
|
|
273
281
|
grand_total_saved = 0
|
|
274
282
|
for repo_name in image_repos:
|
|
275
283
|
log.info("processing repository", repo=repo_name)
|
|
@@ -304,10 +312,10 @@ def main(
|
|
|
304
312
|
|
|
305
313
|
except docker.errors.DockerException as e:
|
|
306
314
|
log.error("failed to connect to Docker daemon", reason=str(e))
|
|
307
|
-
exit(1)
|
|
315
|
+
sys.exit(1)
|
|
308
316
|
except Exception:
|
|
309
317
|
log.exception("an unexpected error occurred")
|
|
310
|
-
exit(1)
|
|
318
|
+
sys.exit(1)
|
|
311
319
|
|
|
312
320
|
|
|
313
321
|
if __name__ == "__main__":
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "docker-image-cleanup"
|
|
3
|
+
version = "0.2.0"
|
|
4
|
+
description = "Clean up old Docker images from local storage with retention controls"
|
|
5
|
+
keywords = [
|
|
6
|
+
"docker",
|
|
7
|
+
"cleanup",
|
|
8
|
+
"images",
|
|
9
|
+
"disk-space",
|
|
10
|
+
]
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
requires-python = ">=3.11"
|
|
13
|
+
dependencies = [
|
|
14
|
+
"click>=8.3.0",
|
|
15
|
+
"docker>=7.1.0",
|
|
16
|
+
"pydantic>=2.12.5",
|
|
17
|
+
"structlog-config>=0.6.0",
|
|
18
|
+
"whenever>=0.9.3",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[[project.authors]]
|
|
22
|
+
name = "Michael Bianco"
|
|
23
|
+
email = "mike@mikebian.co"
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
Repository = "https://github.com/iloveitaly/docker-image-cleanup"
|
|
27
|
+
|
|
28
|
+
[project.scripts]
|
|
29
|
+
docker-image-cleanup = "docker_image_cleanup:main"
|
|
30
|
+
|
|
31
|
+
[build-system]
|
|
32
|
+
requires = ["uv_build>=0.11.0,<0.13"]
|
|
33
|
+
build-backend = "uv_build"
|
|
34
|
+
|
|
35
|
+
[tool.uv.build-backend]
|
|
36
|
+
module-root = ""
|
|
37
|
+
|
|
38
|
+
[tool.pyright]
|
|
39
|
+
exclude = [
|
|
40
|
+
"examples/",
|
|
41
|
+
"playground/",
|
|
42
|
+
"tmp/",
|
|
43
|
+
".venv/",
|
|
44
|
+
"tests/",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
[tool.pytest.ini_options]
|
|
48
|
+
addopts = "--cov --cov-report=term-missing --cov-report=html:tmp/htmlcov"
|
|
49
|
+
|
|
50
|
+
[tool.coverage.run]
|
|
51
|
+
plugins = ["covdefaults"]
|
|
52
|
+
source = ["docker_image_cleanup"]
|
|
53
|
+
|
|
54
|
+
[tool.coverage.report]
|
|
55
|
+
fail_under = 50
|
|
56
|
+
|
|
57
|
+
[dependency-groups]
|
|
58
|
+
dev = [
|
|
59
|
+
"pytest>=8.3.4",
|
|
60
|
+
"pyright[nodejs]>=1.1.408",
|
|
61
|
+
"ruff>=0.8.0",
|
|
62
|
+
"coverage>=7.13.4",
|
|
63
|
+
"pytest-cov>=7.0.0",
|
|
64
|
+
"covdefaults>=2.3.0",
|
|
65
|
+
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "docker-image-cleanup"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.2.0"
|
|
4
4
|
description = "Clean up old Docker images from local storage with retention controls"
|
|
5
5
|
keywords = ["docker", "cleanup", "images", "disk-space"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -22,7 +22,7 @@ docker-image-cleanup = "docker_image_cleanup:main"
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
[build-system]
|
|
25
|
-
requires = ["uv_build>=0.11.0,<0.
|
|
25
|
+
requires = ["uv_build>=0.11.0,<0.13"]
|
|
26
26
|
build-backend = "uv_build"
|
|
27
27
|
|
|
28
28
|
[tool.uv.build-backend]
|
|
File without changes
|