Skip to content

Commit 05416a3

Browse files
author
Patrick M
committed
add post
1 parent e126b0e commit 05416a3

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

_posts/2024-05-23-docker-prune-job.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
layout: post
3+
title: "Docker Prune Cron Job"
4+
date: 2024-05-27 00:00:00 -0400
5+
category: "General"
6+
tags: ["linux", "docker"]
7+
---
8+
9+
This is a helpful way to keep your containers from running out of space. Create a auto-prune cron job and put it in `etc/cron.daily`.
10+
11+
```bash
12+
nano /etc/cron.daily/docker-prune
13+
```
14+
15+
```bash
16+
#!/bin/bash
17+
18+
UUID=00000000-0000-0000-0000-0000000000
19+
20+
curl -m 5 --retry 5 https://healthchecks.io/ping/${UUID}/start &>/dev/null
21+
docker system prune --volumes -af
22+
curl -m 5 --retry 5 https://healthchecks.io/ping/${UUID} &>/dev/null
23+
```
24+
25+
This also includes a ping out to [healthcheck.io](https://healthchecks.io), which is a really handy thing to track your cron jobs. You can also self host the service.

0 commit comments

Comments
 (0)