You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
Added images --lru <path>, which evicts unused images least recently used first rather than largest first. Docker records no last-used time for an image (the Engine API has none, and a pull does not set LastTagTime), so the order comes from a record kept by the container sweep: containers --record-image-use <path> stamps the image of every container the sweep lists as in use now. It reads the container list the sweep fetches anyway, so it adds no call to the daemon; the one exception is the run that creates the record, which lists images once and stamps every image already on the host as older than anything seen since. An image the record has never seen counts as used just now, since it most likely arrived for a launch whose container does not exist yet. Ties are broken by largest reclaimable size, as the default order does.
The record is a text file, <unix seconds> <image id> per line, replaced whole by a rename. A record that cannot be read is left as it is, and that pass orders by size alone; a line in it that cannot be parsed, including one that is not UTF-8, costs only that line; a record that cannot be written never stops the container sweep, and is not started (and its image list not paid for) until it can be saved. An image removed by other means and pulled again before the next eviction pass keeps its old stamp; after removing images by hand, delete the record.
Added images --min-size <size> (e.g. 256MiB, 1G; binary units). Images that would free less are evicted only once no larger candidate is left. Deleting an image holds dockerd's image and layer store locks until its files are gone, stalling every container create and image pull on the host, so a removal should free something worth that. With --lru, size comes first: a large image used a minute ago goes before a small one unused for weeks. The default, 0, leaves the order alone.
Added shims --data-root <path>, dockerd's configured data-root. A shim whose container still has a directory there belongs to a container the daemon knows, since dockerd removes that directory before dropping the container from its list, so it is spared without asking the daemon. The container list is then fetched only when some shim is left to check, which on a host with no orphans is never. The <uid>.<gid> root userns-remap creates below the data-root is searched too.
--record-image-use, --lru and --data-root keep their last value when repeated, so a deployment can append them to a command that may already carry them.