Page MenuHomePhabricator

docker-gc: A tool for partially pruning docker resources
Closed, ResolvedPublic

Description

Periodically running docker system prune on a node which regularly runs docker containers is a typical way to prevent unused resources from accumulating forever.

However docker system prune is very drastic in that it deletes _all_ unused resources, even those which are regularly used. It would be useful to have a tool allows the operator to specify high and low water marks for resources of a given type. Instead of deleting everything, it will delete just enough to reach the low water mark. Also, instead of deleting resources indiscriminately, it will delete least recently used resources first.

Event Timeline

dancy renamed this task from A tool for partially pruning docker resources to docker-gc: A tool for partially pruning docker resources.Oct 21 2021, 3:35 PM
dancy triaged this task as High priority.
dancy updated the task description. (Show Details)

Change 732722 had a related patch set uploaded (by Ahmon Dancy; author: Ahmon Dancy):

[operations/docker-images/production-images@master] First rev of WMF docker-resource-monitor/docker-gc images

https://gerrit.wikimedia.org/r/732722

I have a general doubt about packaging for this software: the patch above creates docker images to run the software, but it needs to talk to the docker daemon directly. "Docker in docker" solutions require some permission changes, or to run the container as root.

Where do you intend to run this software?

I have a general doubt about packaging for this software: the patch above creates docker images to run the software, but it needs to talk to the docker daemon directly. "Docker in docker" solutions require some permission changes, or to run the container as root.

That's right. Specifically, -v /var/run/docker.sock:/var/run/docker.sock needs to be passed on the docker run command line.

Packaging using a docker image is not a requirement, just a convenience.

Where do you intend to run this software?

The intention is to run on gitlab runners to keep the image and volume usage constrained.

Change 732722 merged by Giuseppe Lavagetto:

[operations/docker-images/production-images@master] First rev of WMF docker-gc image

https://gerrit.wikimedia.org/r/732722

dancy claimed this task.