upgrade janitor to latest image version, docker 1.9+ support (#154)

* Janitor: new docker-cleanup image version

The initial motivation for this version bump is support for docker 1.9+
Currently volumes don't get removed properly and lead to containers to
stall at start up, which is a pain to diagnose in rancher.

ref: https://github.com/meltwater/docker-cleanup/issues/24

* janitor: add support for KEEP_CONTAINERS_NAMED feature

* janitor: document '**None**' and '**All**'

* janitor: run with privileged mode unconditionnally

According to @sshipway, it seemed to be incompatible with a lot of
docker/rancher versions.

* janitor: bump docker-cleanup image version to 1.8.0
This commit is contained in:
Marc Fournier 2016-09-22 22:33:54 +02:00 committed by Bill Maxwell
parent 9a06ee761a
commit 0d318696f8
4 changed files with 62 additions and 4 deletions

View File

@ -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

View File

@ -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"

View File

@ -43,6 +43,8 @@ However it will not match
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

View File

@ -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 <s.shipway@auckland.ac.nz>