Crontabs are fickle, lets just make it a service we can run on all nodes!
  • PHP 67.2%
  • Dockerfile 28.6%
  • HCL 4.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2022-09-12 00:47:18 +02:00
.github/workflows Initial version 2022-08-26 12:48:41 +02:00
src Add cghooks + php-cs-fixer 2022-08-26 13:25:16 +02:00
.gitignore Add cghooks + php-cs-fixer 2022-08-26 13:25:16 +02:00
.php-cs-fixer.php no_superfluous_phpdoc_tags=true is too agressive. Some "superfluous" phpdoc tags are extremely useful for IDE type hinting. 2022-09-12 00:47:18 +02:00
bake.hcl Initial version 2022-08-26 12:48:41 +02:00
cghooks.lock Add cghooks.lock 2022-08-26 13:26:03 +02:00
composer.json Add cghooks + php-cs-fixer 2022-08-26 13:25:16 +02:00
composer.lock Add cghooks + php-cs-fixer 2022-08-26 13:25:16 +02:00
Dockerfile Initial version 2022-08-26 12:48:41 +02:00
prune.php Add cghooks + php-cs-fixer 2022-08-26 13:25:16 +02:00
README.md Improve readme. 2022-08-26 13:30:41 +02:00

Automated Docker Service Pruning

Crontabs are fickle, lets just make it a service we can run on all nodes!

Environment variables:

  • INTERVAL_SECONDS: Delay before running again
  • DOCKER_HOST: Allows overriding default /var/run/docker.sock

Simply deploy this service to affected nodes, with access to the docker socket (or via DOCKER_HOST envvar)

Usage:

docker service create \
    --name pruner \
    --mount type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock \
    --mode=global \
    --env INTERVAL_SECONDS=86400 \
    --restart-max-attempts=0 \
    --restart-condition=any \
        matthewbaggett/pruner