Container to manage lifecycle of images from DigitalOcean Container Registry targeting old tags and running DigitalOcean Garbage Collection
An example of a command to run one-time DOCR cleanup:
bashdocker run --rm \
-e REGISTRY=myregistry \
-e REPOSITORY=myapp \
-e RETENTION_DAYS=2 \
-e KEEP_TAGS=50 \
-e DIGITALOCEAN_ACCESS_TOKEN=dop_v1_xxxxyyyy \
-e DEBUG=true \
oci.corewide.com/docker/docr-cleanup:v1.1.2
Alternatively, put your environment variables in docr-cleanup.env and use docker compose to run the container using Docker Compose
Pull the image from the registry to your machine:
shelldocker pull oci.corewide.com/docker/docr-cleanup:1.1.2
Container to manage lifecycle of images from DigitalOcean Container Registry targeting old tags and running DigitalOcean Garbage Collection
An example of a command to run one-time DOCR cleanup:
bashdocker run --rm \
-e REGISTRY=myregistry \
-e REPOSITORY=myapp \
-e RETENTION_DAYS=2 \
-e KEEP_TAGS=50 \
-e DIGITALOCEAN_ACCESS_TOKEN=dop_v1_xxxxyyyy \
-e DEBUG=true \
oci.corewide.com/docker/docr-cleanup:v1.1.2
Alternatively, put your environment variables in docr-cleanup.env and use docker compose to run the container using Docker Compose
All notable changes to this project are documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
First stable version.
An example of a command to run one-time DOCR cleanup:
bashdocker run --rm \
-e REGISTRY=myregistry \
-e REPOSITORY=myapp \
-e RETENTION_DAYS=2 \
-e KEEP_TAGS=50 \
-e DIGITALOCEAN_ACCESS_TOKEN=dop_v1_xxxxyyyy \
-e DEBUG=true \
oci.corewide.com/docker/docr-cleanup:1.1.2
An example docker-compose.yml file with predefined options to run as a one-shot container triggered by a cron job:
yamlservices:
docr-cleanup:
image: oci.corewide.com/docker/docr-cleanup:1.1.2
container_name: docr-cleanup
env_file: docr-cleanup.env
restart: no
cron0 0 * * * root docker compose -f /path/to/docker-compose.yml
Make sure to put your environment variables inside docr-cleanup.env file in the same location as ./docker-compose.yml. An example of docr-cleanup.env:
bashREGISTRY=myregistry
REPOSITORY=myapp
RETENTION_DAYS=7
KEEP_TAGS=50
DIGITALOCEAN_ACCESS_TOKEN=dop_v1_xxxxyyyy
DEBUG=true
| Variable | Description | Default | Required | Sensitive |
|---|---|---|---|---|
DIGITALOCEAN_ACCESS_TOKEN |
Access token to authenticate at DigitalOcean API | yes | yes | |
REGISTRY |
DOCR registry name | yes | no | |
REPOSITORY |
DOCR repository name | yes | no | |
KEEP_TAGS |
Number of recent tags (starting from the newest) to keep during the cleanup | 50 |
no | no |
RETENTION_DAYS |
Number of days to retain images | 7 |
no | no |
DEBUG |
Enable debug output | false |
no | no |
These components are included as is under the terms of their corresponding licenses.
| Component | License |
|---|---|
| doctl | Apache License 2.0 |