From 5d12e5ebddcb29529cb4a025364362e8f2141493 Mon Sep 17 00:00:00 2001 From: sshipway Date: Tue, 29 Mar 2016 21:21:13 +0000 Subject: [PATCH] Add updated Janitor template using official meltwater/docker-cleanup container image rather than the temporary patched version Some fixes to the README documentation to help clarify behaviour and fix typos. --- templates/janitor/2/docker-compose.yml | 18 ++++++++++++++ templates/janitor/2/rancher-compose.yml | 31 +++++++++++++++++++++++++ templates/janitor/README.md | 11 +++++---- templates/janitor/config.yml | 2 +- 4 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 templates/janitor/2/docker-compose.yml create mode 100644 templates/janitor/2/rancher-compose.yml diff --git a/templates/janitor/2/docker-compose.yml b/templates/janitor/2/docker-compose.yml new file mode 100644 index 0000000..c74c927 --- /dev/null +++ b/templates/janitor/2/docker-compose.yml @@ -0,0 +1,18 @@ +cleanup: + image: meltwater/docker-cleanup:1.6.0 + environment: + CLEAN_PERIOD: ${FREQUENCY} + DELAY_TIME: "900" + KEEP_IMAGES: "${KEEP}" + KEEP_CONTAINERS: "${KEEPC}" + LOOP: "true" + DEBUG: "0" + labels: + io.rancher.scheduler.global: "true" + io.rancher.scheduler.affinity:host_label_ne: "${EXCLUDE_LABEL}" + privileged: true + tty: false + stdin_open: false + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - /var/lib/docker:/var/lib/docker diff --git a/templates/janitor/2/rancher-compose.yml b/templates/janitor/2/rancher-compose.yml new file mode 100644 index 0000000..81b347d --- /dev/null +++ b/templates/janitor/2/rancher-compose.yml @@ -0,0 +1,31 @@ +.catalog: + name: "Janitor" + version: "v1.6" + description: "Docker cleanup" + uuid: janitor-2 + questions: + - variable: "FREQUENCY" + label: "Frequency" + description: "Run the cleanup on a cycle of this many seconds" + default: 3600 + required: true + type: "int" + - variable: "EXCLUDE_LABEL" + label: "Exclude label" + description: "Specify a Rancher host label here that will be used to determine on which hosts the Janitor container should not deploy." + default: janitor.exclude=true + required: true + type: "string" + - variable: "KEEP" + label: "Keep images" + description: "A comma separated list of images that should never be removed. These are left-anchored Bash Shell Wildcard patterns." + default: "rancher/" + required: false + type: "string" + - variable: "KEEPC" + label: "Keep containers" + description: "A comma separated list of images that should never have stopped containers removed. These are left-anchored Bash Shell Wildcard patterns." + default: "*:*" + required: false + type: "string" + diff --git a/templates/janitor/README.md b/templates/janitor/README.md index 08f78f3..68f08d5 100644 --- a/templates/janitor/README.md +++ b/templates/janitor/README.md @@ -11,10 +11,13 @@ This will run a task daily (by default) that will delete any unused image, and any orphaned volume. The rancher container images are excluded from the list of images to clean up, and you can add your own containers to the exclude list if you wish. It will also remove any stopped containers -that are taking up space. +that are taking up space; note that this may not be what you want if you +are using stopped containers to hold volumes! If this is the case, use the +Keep List below. -This will halp to prevent the /var/lib/docker filesystem from filling up -with old and unused container images. +This cleanup will help to prevent the /var/lib/docker filesystem from filling +up with old and unused container images, which is an issue on lighter-weight +Docker hosts. ### Keep list @@ -31,7 +34,7 @@ patterns. For example, an image called **foo/bar:latest** will match: * \*:\* * fo -However it will notmatch +However it will not match * foo/baz * bar:latest diff --git a/templates/janitor/config.yml b/templates/janitor/config.yml index ec38060..e0241f0 100644 --- a/templates/janitor/config.yml +++ b/templates/janitor/config.yml @@ -1,7 +1,7 @@ name: Janitor description: | Automatic cleanup of unused images on hosts, in order to save disk space. -version: v1.5.2 +version: v1.6 category: Monitoring maintainer: Steve Shipway