FEATURE REQUEST: Delete all Containers and Images of the current Project.
Use Case:
- If one ends the local development for a project, the images are not needed anymore. One can not state that the next project uses same Images and also even if, the Image pull is not time consuming. Therefore I would say Diskspace > Imagedownload.
Feature-Scope:
- Delete all Containers and Images of the current Project when exiting the Container. In the end all I want is smth like this: (Also an Option for dangling Images could be useful in terms of not littering ones Disk, but that have you to decide)
if [ $L3D_ALWAYS_CLEANUP -ne 0 ]; then
echo "Removing unused l3d and wodby docker images.";
docker rmi $(docker images --format '{{.Repository}}:{{.Tag}}' | egrep 'l3d|wodby');
# Remove dangling images. Dangling means they are not referenced by an active Container.
dangling="$(docker images --filter "dangling=true" -q --no-trunc)";
if [ "$dangling" != "" ]; then
echo "Removing dangling docker images.";
docker rmi $dangling;
fi;
fi;
Its just about the Images. If one wants to remove Containers Networks etc. One can use the l3d delete Option and/or write a wrapper script around it.
Summary
- Delete Images of Project on l3d exit. Steer via Environmental Variable like L3D_ALWAYS_CLEANUP=1
If you need further specification please let me know. regards, nils