Created
February 16, 2023 16:00
-
-
Save WeslyG/314c42fd5fba7eae39ae0426bf3a0b68 to your computer and use it in GitHub Desktop.
cron job for clean local docker images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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