项目作者: softonic

项目描述 :
Docker system prune automatically
高级语言: Dockerfile
项目地址: git://github.com/softonic/docker-system-prune.git
创建时间: 2017-03-02T14:03:48Z
项目社区:https://github.com/softonic/docker-system-prune

开源协议:Other

下载


Docker System Prune

Executes the docker system prune command to allow automatize its execution.

Usage

This image allows you to program automatically when a prune will be done in your hosts.

The main advantage over external solutions like a cron job is that you can launch it in a cluster easily: “fire & forget”

For example in a Swarm mode cluster:

  1. docker \
  2. service create --name docker-system-prune \
  3. --mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
  4. --mode global \
  5. --restart-delay 86400s \
  6. --restart-max-attempts 3650 \
  7. softonic/docker-system-prune

This launches the “prune” command in all the nodes in the cluster once a day, more or less, during 10 years.

By default it launches the service with the parameters --force and --all, but you can change these if you like just
adding then when defining the service. For example:

  1. docker \
  2. service create --name docker-system-prune \
  3. --mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
  4. --mode global \
  5. --restart-delay 86400s \
  6. --restart-max-attempts 3650 \
  7. softonic/docker-system-prune \
  8. --volumes --all

!!! info
You need to mount the docker socket to allow the command to be executed in the host.

Requirements

As it executes the docker system prune command this can work only in nodes with Docker versions >=1.13