nanobox-io / nanobox

The ideal platform for developers
https://nanobox.io
MIT License
1.6k stars 89 forks source link

Image cache management - purge and prune #508

Open sanderson opened 7 years ago

sanderson commented 7 years ago

I've run into a few issues with my image cache:

  1. My image cache gets really big and eats up all my VMs disk space
  2. In one case, my VM died while extracting a image. Now I can't pull the image, because docker sees that the directory it's trying to pull into isn't empty.

I think we need to provide a way to manage the image cache. Maybe even an image command with subcommands. Possibly something like:

# list cached images
nanobox image ls

# update all images
nanobox image update

# update a specific image
nanobox image update nanobox/mysql:5.6

# purge all images
nanobox image rm --all
# OR
nanobox image purge

# remove a specific image
nanobox image rm nanobox/mysql:5.6

# prune unused images (images no longer used by registered apps)
nanobox image prune
sanderson commented 6 years ago

Part of the reason that image caches grow is because when a data component is provisioned, we use the current version of the image. When a new image is available, we can't re-provision the data component because it would wipe the data, so the old out-dated image has to be kept around. We need to provide a way to migrate data from containers using old images to containers using new images:

nanobox image migrate

This is going to migrate all data from containers using old images
to new containers using updated images. This process may take a while.
Would you like to proceed? (Y/n)

We may even want to run a nanobox image update before the migration and a nanobox image prune after.