Skip to content

Commit

Permalink
Add FAQ about keeping latest N docker images
Browse files Browse the repository at this point in the history
fix #61
  • Loading branch information
allburov authored Sep 5, 2022
1 parent ebb9318 commit 74e31a9
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,27 @@ RULES = [
]
```

## How to keep latest N docker images?
We can combine docker rules with usual "files" rules!

The idea came from https://github.com/devopshq/artifactory-cleanup/issues/61

```python
CleanupPolicy(
'docker-demo-cleanup',
# Select repo
rules.repo('docker-demo'),
# Delete docker images older than 30 days
rules.DeleteDockerImagesOlderThan(days=30),
# Keep these tags for all images
rules.ExcludeDockerImages(['*:latest', '*:release*']),
# Exclude these docker tags
rules.ExcludePath("base-tools*"),
# Keep 3 docker tags for all images
rules.KeepLatestNFilesInFolder(count=3),
)
```


# Release

Expand Down

0 comments on commit 74e31a9

Please sign in to comment.