docker-image-cleanup 0.1.1__tar.gz → 0.1.2__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.1 → docker_image_cleanup-0.1.2}/PKG-INFO +40 -1
- {docker_image_cleanup-0.1.1 → docker_image_cleanup-0.1.2}/README.md +39 -0
- {docker_image_cleanup-0.1.1 → docker_image_cleanup-0.1.2}/pyproject.toml +1 -1
- {docker_image_cleanup-0.1.1 → docker_image_cleanup-0.1.2}/docker_image_cleanup/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: docker-image-cleanup
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
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
|
|
@@ -61,6 +61,45 @@ docker-image-cleanup --min-age-days 7 myrepo/myimage
|
|
|
61
61
|
docker-image-cleanup --num-recent 3 --min-age-days 7 myrepo/myimage
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
+
## Docker
|
|
65
|
+
|
|
66
|
+
This tool is available as a Docker image on GHCR. It's designed to run on a schedule using a built-in cron system.
|
|
67
|
+
|
|
68
|
+
### Environment Variables
|
|
69
|
+
|
|
70
|
+
- `TARGET_REPOS`: A space-separated list of image repositories to clean (e.g., `myrepo/image1 myrepo/image2`). **Required**.
|
|
71
|
+
- `SCHEDULE`: A cron expression for the cleanup schedule (default: `0 0 * * *` - daily at midnight).
|
|
72
|
+
- `NUM_RECENT`: Number of recent tags to keep (default: `5`).
|
|
73
|
+
- `MIN_AGE_DAYS`: Minimum age in days to keep tags (default: `30`).
|
|
74
|
+
|
|
75
|
+
### Docker Run
|
|
76
|
+
|
|
77
|
+
You must mount the Docker socket so the container can interact with your local Docker daemon:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
docker run -d \
|
|
81
|
+
--name docker-image-cleanup \
|
|
82
|
+
-v /var/run/docker.sock:/var/run/docker.sock \
|
|
83
|
+
-e TARGET_REPOS="myrepo/image1 myrepo/image2" \
|
|
84
|
+
ghcr.io/iloveitaly/docker-image-cleanup:latest
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Docker Compose
|
|
88
|
+
|
|
89
|
+
```yaml
|
|
90
|
+
services:
|
|
91
|
+
cleanup:
|
|
92
|
+
image: ghcr.io/iloveitaly/docker-image-cleanup:latest
|
|
93
|
+
restart: unless-stopped
|
|
94
|
+
volumes:
|
|
95
|
+
- /var/run/docker.sock:/var/run/docker.sock
|
|
96
|
+
environment:
|
|
97
|
+
- TARGET_REPOS=myrepo/image1 myrepo/image2
|
|
98
|
+
- SCHEDULE=0 0 * * *
|
|
99
|
+
- NUM_RECENT=5
|
|
100
|
+
- MIN_AGE_DAYS=30
|
|
101
|
+
```
|
|
102
|
+
|
|
64
103
|
## Features
|
|
65
104
|
|
|
66
105
|
- Removes old Docker images based on age and recency criteria
|
|
@@ -45,6 +45,45 @@ docker-image-cleanup --min-age-days 7 myrepo/myimage
|
|
|
45
45
|
docker-image-cleanup --num-recent 3 --min-age-days 7 myrepo/myimage
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
## Docker
|
|
49
|
+
|
|
50
|
+
This tool is available as a Docker image on GHCR. It's designed to run on a schedule using a built-in cron system.
|
|
51
|
+
|
|
52
|
+
### Environment Variables
|
|
53
|
+
|
|
54
|
+
- `TARGET_REPOS`: A space-separated list of image repositories to clean (e.g., `myrepo/image1 myrepo/image2`). **Required**.
|
|
55
|
+
- `SCHEDULE`: A cron expression for the cleanup schedule (default: `0 0 * * *` - daily at midnight).
|
|
56
|
+
- `NUM_RECENT`: Number of recent tags to keep (default: `5`).
|
|
57
|
+
- `MIN_AGE_DAYS`: Minimum age in days to keep tags (default: `30`).
|
|
58
|
+
|
|
59
|
+
### Docker Run
|
|
60
|
+
|
|
61
|
+
You must mount the Docker socket so the container can interact with your local Docker daemon:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
docker run -d \
|
|
65
|
+
--name docker-image-cleanup \
|
|
66
|
+
-v /var/run/docker.sock:/var/run/docker.sock \
|
|
67
|
+
-e TARGET_REPOS="myrepo/image1 myrepo/image2" \
|
|
68
|
+
ghcr.io/iloveitaly/docker-image-cleanup:latest
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Docker Compose
|
|
72
|
+
|
|
73
|
+
```yaml
|
|
74
|
+
services:
|
|
75
|
+
cleanup:
|
|
76
|
+
image: ghcr.io/iloveitaly/docker-image-cleanup:latest
|
|
77
|
+
restart: unless-stopped
|
|
78
|
+
volumes:
|
|
79
|
+
- /var/run/docker.sock:/var/run/docker.sock
|
|
80
|
+
environment:
|
|
81
|
+
- TARGET_REPOS=myrepo/image1 myrepo/image2
|
|
82
|
+
- SCHEDULE=0 0 * * *
|
|
83
|
+
- NUM_RECENT=5
|
|
84
|
+
- MIN_AGE_DAYS=30
|
|
85
|
+
```
|
|
86
|
+
|
|
48
87
|
## Features
|
|
49
88
|
|
|
50
89
|
- Removes old Docker images based on age and recency criteria
|
|
File without changes
|