Sign inSign up

boomer41/image-pruner

By boomer41

•Updated 7 days ago

Simple container that periodically deletes unused images from CRI runtime like containerd.

Image
0

2.7K

boomer41/image-pruner repository overview

This image is a simple loop periodically pruning all unused image from a CRI compatible container runtime.

Environment variables:

  • PRUNE_INTERVAL: How often the pruning happens. Default 86000 (24h).
  • PRUNE_ARGUMENTS: Arguments passed to crictl rmi. Default --all --prune.
  • CONTAINER_RUNTIME_ENDPOINT: Which socket crictl should use. Default unix:///run/crio/crio.sock.

As an example, a Kubernetes DaemonSet that prunes everything from the underlying containerd runtime on all nodes is shown here:

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: image-pruner
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: image-pruner
  template:
    metadata:
      labels:
        app.kubernetes.io/name: image-pruner
    spec:
      hostPID: true
      containers:
        - name: pruner
          image: docker.io/boomer41/image-pruner:latest
          imagePullPolicy: Always
          securityContext:
            allowPrivilegeEscalation: false
            privileged: false
            readOnlyRootFilesystem: true
            capabilities:
              drop:
                - ALL
          env:
            - name: CONTAINER_RUNTIME_ENDPOINT
              value: /run/containerd/containerd.sock
          volumeMounts:
            - name: containerd-sock
              mountPath: /run/containerd/containerd.sock
          resources:
            requests:
              cpu: 1m
              memory: 16Mi
            limits:
              memory: 64Mi
      volumes:
        - name: containerd-sock
          hostPath:
            path: /run/containerd/containerd.sock
      restartPolicy: Always
      tolerations:
        - operator: Exists

Tag summary

Content type

Image

Digest

sha256:2f40b9f8d…

Size

22.5 MB

Last updated

7 days ago

docker pull boomer41/image-pruner