diff --git a/templates/janitor/3/docker-compose.yml b/templates/janitor/3/docker-compose.yml new file mode 100644 index 0000000..3109a9a --- /dev/null +++ b/templates/janitor/3/docker-compose.yml @@ -0,0 +1,20 @@ +cleanup: + image: meltwater/docker-cleanup:1.8.0 + environment: + CLEAN_PERIOD: ${FREQUENCY} + DELAY_TIME: "900" + KEEP_IMAGES: "${KEEP}" + KEEP_CONTAINERS: "${KEEPC}" + KEEP_CONTAINERS_NAMED: "${KEEPCN}" + LOOP: "true" + DEBUG: "0" + labels: + io.rancher.scheduler.global: "true" + io.rancher.scheduler.affinity:host_label_ne: "${EXCLUDE_LABEL}" + net: none + 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/3/rancher-compose.yml b/templates/janitor/3/rancher-compose.yml new file mode 100644 index 0000000..19ca95b --- /dev/null +++ b/templates/janitor/3/rancher-compose.yml @@ -0,0 +1,36 @@ +.catalog: + name: "Janitor" + version: "v1.7" + description: "Docker cleanup" + uuid: janitor-3 + 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" + - variable: "KEEPCN" + label: "Keep named containers" + description: "A comma separated list of names of exited or dead container that should never be removed. These are left-anchored Bash Shell Wildcard patterns." + default: "**None**" + required: false + type: "string" diff --git a/templates/janitor/README.md b/templates/janitor/README.md index 68f08d5..a60f94b 100644 --- a/templates/janitor/README.md +++ b/templates/janitor/README.md @@ -15,13 +15,13 @@ 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 cleanup will help to prevent the /var/lib/docker filesystem from filling +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 -You can specify match patterns for unused Images, and stopped Containers, +You can specify match patterns for unused Images, and stopped Containers, which should be excluded from the cleanup. The match patterns are comma-separated Left Anchored Bash Shell wildcard @@ -40,9 +40,11 @@ However it will not match * bar:latest * foo/\*:v1 -By default, nothing will be matched. If you want to match everything, +By default, nothing will be matched. If you want to match everything, then use a pattern **\*:\*** +The self-descriptive values '\*\*None\*\*' and '\*\*All\*\*' can also be used. + ### Warning If you are using 'run-once' sidekick containers that mount a volume, then diff --git a/templates/janitor/config.yml b/templates/janitor/config.yml index e0241f0..082b015 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.6 +version: v1.7 category: Monitoring maintainer: Steve Shipway