Repository: mesos Updated Branches: refs/heads/1.5.x f023091fb -> 5453f3fa4
Documented new image gc support in Mesos containerizer. Review: https://reviews.apache.org/r/64813/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/5453f3fa Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/5453f3fa Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/5453f3fa Branch: refs/heads/1.5.x Commit: 5453f3fa40c8b3cd2e1395d72d9ed72759b8450f Parents: e319d1f Author: Zhitao Li <[email protected]> Authored: Sun Dec 31 18:28:04 2017 +0800 Committer: Gilbert Song <[email protected]> Committed: Sun Dec 31 20:24:29 2017 +0800 ---------------------------------------------------------------------- docs/container-image.md | 40 ++++++++++++++++++++++++++++++++++++++++ docs/operator-http-api.md | 30 ++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/5453f3fa/docs/container-image.md ---------------------------------------------------------------------- diff --git a/docs/container-image.md b/docs/container-image.md index 99f4f5c..1112bd7 100644 --- a/docs/container-image.md +++ b/docs/container-image.md @@ -390,6 +390,46 @@ and mount it under the sandbox directory. The executor can perform `pivot_root` or `chroot` itself to enter the container root filesystem. +## Garbage Collect Unused Container Images + +Experimental support of garbage-collecting unused container images was added at +Mesos 1.5. This can be either configured automatically via a new agent flag +`--image_gc_config`, or manually invoked through agent's +[v1 Operator HTTP API](operator-http-api.md#prune_images). This can be used +to avoid unbounded disk space usage of image stores. + +This is implemented with a simple mark-and-sweep logic. When image GC happens, +we check all layers and images referenced by active running containers and avoid +removing them from the image store. As a pre-requisite, if there are active +containers launched before Mesos 1.5.0, we cannot determine what images can be +safely garbage collected, so agent will refuse to invoke image GC. To garbage +collect container images, users are expected to drain all containers launched +before Mesos 1.5.0. + +**NOTE**: currently, the image GC is only supported for docker store in Mesos +Containerizer. + +### Automatic Image GC through Agent Flag + +To enable automatic image GC, use the new agent flag `--image_gc_config`: + + --image_gc_config=file:///home/vagrant/image-gc-config.json + +or as a JSON object, + + --image_gc_config="{ \ + \"image_disk_headroom\": 0.1, \ + \"image_disk_watch_interval\": { \ + \"nano_seconds\": 3600 \ + }, \ + \"excluded_images\": \[ \] \ + }" + + +### Manual Image GC through HTTP API +See `PRUNE_IMAGES` section in +[v1 Operator HTTP API](operator-http-api.md#prune_images) for manual image GC +through the agent HTTP API. ## References http://git-wip-us.apache.org/repos/asf/mesos/blob/5453f3fa/docs/operator-http-api.md ---------------------------------------------------------------------- diff --git a/docs/operator-http-api.md b/docs/operator-http-api.md index f81e5bc..af6a3a6 100644 --- a/docs/operator-http-api.md +++ b/docs/operator-http-api.md @@ -3848,3 +3848,33 @@ REMOVE_NESTED_CONTAINER HTTP Response (JSON): HTTP/1.1 200 OK ``` + +### PRUNE_IMAGES + +This call triggers garbage collection for container images. This call can +only be made when all running containers are launched with Mesos version 1.5 +or newer. An optional list of excluded images from GC can be speficied via +`prune_images.excluded_images` field. + +``` +PRUNE_IMAGES HTTP Request (JSON): + +POST /api/v1 HTTP/1.1 + +Host: agenthost:5051 +Content-Type: application/json +Accept: application/json + +{ + "type": "PRUNE_IMAGES", + "prune_images": { + "excluded_images": [ + {"type":"DOCKER","docker":{"name":"mysql:latest"}} + ] + } +} + +PRUNE_IMAGES HTTP Response (JSON): + +HTTP/1.1 200 OK +```
