Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Digital Ocean Registry

Cleanup / Garbage collection

The cronjob:

apiVersion: batch/v1
kind: CronJob
metadata:
  name: do-registry-gc
spec:
  schedule: "0 0 * * *" # This runs the job every day at midnight
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: do-registry-gc
            image: digitalocean/doctl:latest
            command: [ "/app/doctl" ]
            args: [ "registry", "garbage-collection", "start", "--force" ]
            env:
            - name: DIGITALOCEAN_ACCESS_TOKEN
              valueFrom:
                secretKeyRef:
                  name: do-api-token
                  key: token
          restartPolicy: Never

And the token:

apiVersion: v1
kind: Secret
metadata:
  name: do-api-token
type: Opaque
data:
  token: ABCD..............