Skip to content

Instantly share code, notes, and snippets.

@WeslyG
Created February 16, 2023 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WeslyG/314c42fd5fba7eae39ae0426bf3a0b68 to your computer and use it in GitHub Desktop.
Save WeslyG/314c42fd5fba7eae39ae0426bf3a0b68 to your computer and use it in GitHub Desktop.
cron job for clean local docker images
apiVersion: batch/v1
kind: CronJob
metadata:
name: cleaner
spec:
schedule: "0 8 * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: cleaner
image: docker:dind
imagePullPolicy: IfNotPresent
volumeMounts:
- name: dockersock
mountPath: "/var/run/docker.sock"
command:
- /usr/local/bin/docker
- system
- prune
- -af
volumes:
- name: dockersock
hostPath:
path: /var/run/docker.sock
restartPolicy: OnFailure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment