portworx / lcfs

LCFS Graph driver for Docker
Apache License 2.0
300 stars 27 forks source link

Provide a tool for cleaning up orphaned layers #40

Open jjobi opened 7 years ago

jjobi commented 7 years ago

The following sequence of operations happen while creating/removing an image layer.

  1. Create a layer, populate with data.
  2. Update bunch of files in /var/lib/docker about the new image (the last one is repositories.json).
  1. Update a bunch of files in /var/lib/docker (which also replaces repositories.json with new data).
  2. Remove the layer corresponding to the image being deleted.

If the system crashes after step 1 during the above operations, there will be an orphaned image in the graphdriver. Need a utilitly to clean up such orphaned layers.

See https://github.com/portworx/lcfs/issues/14 on how Docker keeps track of layers.