Skip to content

Schedule periodic prune inside your swarm with one line!

Notifications You must be signed in to change notification settings

f213/periodic-docker-prune

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Periodic docker prune

head

The problem

When running a swarm, periodicaly updating service images, each worker node starts to hold stale versions of old images, taking disk space.

Common solution is to run docker prune via cron, but we do not want to configure our workers besides joining to the swarm, aren't we?

So this image is designed for running periodic system clean with zero host configuration.

Swarm

version: '3.6'

services:
  periodic-prune:
    image: f213/periodic-docker-prune:1.1.0
        
    # may be omitted, 05:24 by default
    environment:
      AT: '02:44'

    deploy:
      mode: global
      
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      

Manual

$ docker run -v "/var/run/docker.sock:/var/run/docker.sock" -e AT='17:20' f213/periodic-docker-prune