Sign inSign up

mega349/docker-prune-dockerized

By mega349

•Updated about 1 year ago

Periodically prune unneeded leftovers from docker

Image
0

319

mega349/docker-prune-dockerized repository overview

⁠Docker-prune Dockerized

GitLab: https://gitlab.com/docker_repos/docker-prune-dockerized⁠
DockerHub: https://hub.docker.com/r/mega349/docker-prune-dockerized⁠


⁠Description

Periodically prune unneeded leftovers from docker, using cron and docker prune command.
The used command will be build from env vars:
docker $PRUNE_TYPE prune -f $PRUNE_PARAM


⁠⚠️ ATTENTION!

Using docker prune will delete resources depending on your setup!
With default settings, it will remove unused (including temporarily unused):

  • Containers
  • Networks
  • Images
  • Build caches

👉 Read the official documentation and proceed with caution!


⁠Example Docker Compose file

version: '3.8'

services:
  app:
    image: mega349/docker-prune-dockerized:latest
    restart: on-failure
    volumes:
          - /var/run/docker.sock:/var/run/docker.sock
          - /var/lib/docker:/var/lib/docker:ro
    environment:
      - TZ=Europe/Amsterdam
      - CRON_TIME=*/5 * * * *
      - USERNAME=root
      - PRUNE_TYPE=system
      - PRUNE_PARAM=--volumes  # NOT default, but an example

⁠Environment vars

ENVDescriptionInfodefault valueNEEDED
TZYour TimezoneTimezone identifierEurope/AmsterdamNo
CRON_TIMEBackup time in cron syntax*/5 * * * *No
USERNAMERun command as given userrootNo
PRUNE_TYPEWhat type to pruneTake a look at Prune typs⁠systemNo
PRUNE_PARAMAdditional parameter for used prune commandTake a look at the official docker dokuNo

⁠Prune typs

Please check the official doku for effects and additional parameter

TypeDescriptionOfficial Doku
systemeverythink except volumessystem_prune⁠
networkonly networksnetwork_prune⁠
imageonly imagesimage_prune⁠
containeronly containercontainer_prune⁠
volumeonly volumesvolume_prune⁠

Tag summary

Content type

Image

Digest

sha256:9df110095…

Size

200.2 MB

Last updated

about 1 year ago

docker pull mega349/docker-prune-dockerized