Container to manage lifecycle of images from DigitalOcean Container Registry targeting old tags and running DigitalOcean Garbage Collection

Usage

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

Log in to Corewide container registry

Once you have a Corewide Solutions Portal account, get your registry password here and use it to log in via CLI:

 shelldocker login oci.corewide.com
Download the image

Pull the image from the registry to your machine:

 shelldocker pull oci.corewide.com/docker/docr-cleanup:1.1.2

DOCR Image Cleanup

Image cleanup solution for DigitalOcean Container Registry
€730
75% off
€190
Deploy to Kubernetes BUY
1.1.2 released 2 months, 3 weeks ago
New version approx. every 6 weeks

Container to manage lifecycle of images from DigitalOcean Container Registry targeting old tags and running DigitalOcean Garbage Collection

Usage

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

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

During the cleanup, the KEEP_TAGS value is used to exclude the newest tags from selection. Only then are the tag dates compared with RETENTION_DAYS

These components are included as is under the terms of their corresponding licenses.

Component License
doctl Apache License 2.0

Not sure where to start?
Let's find your perfect match.