| parameter | default | explain |
|---|---|---|
| once | false | Perform the cleanup task only once |
| cron | "0 0 3 * MON *" | Perform the cleaning task regularly and follow the cron expression default 0 0 3 * MON * |
| force | true | Force image removal |
| tryRun | false | Try to run without deleting the image |
run in docker
docker run -it -d --name=clean-image -v /var/run/docker.sock:/var/run/docker.sock jinxuan/cleans_image:0.0.1 --once=true
run in k8s
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: cleans-image
labels:
app: cleans-image
spec:
updateStrategy:
type: RollingUpdate
template:
metadata:
labels:
app: cleans-image
spec:
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
containers:
- name: cleans-image
image: jinxuan/cleans_image:0.0.1
args:
- "--cron=0 0 0 * * *"
volumeMounts:
- name: sock
mountPath: /var/run/docker.sock
terminationGracePeriodSeconds: 30
volumes:
- name: sock
hostPath:
path: /var/run/docker.sock
Content type
Image
Digest
Size
72.6 MB
Last updated
almost 7 years ago
docker pull jinxuan/cleans_image:0.0.1