eclipse-leda / leda-utils

Convenience scripts for Eclipse Leda quickstart tutorials
https://eclipse-leda.github.io/leda/
Apache License 2.0
5 stars 5 forks source link

Pruning container garbage and other leftovers #42

Open mikehaller opened 1 year ago

mikehaller commented 1 year ago

During development, eg when creating lots of container instances, a manual pruning may become necessary. As long as the container runtime is not tuned for that use case, the leftovers will fill the disk pretty fast, when the developers is doing a lot of trial&error deployments without cleaning up old container instances up front.

One user reported: • Is there any command for pruning all the containers? I see in the cheat sheet this command - nerdctl system prune –all. But it doesn’t work. I could not find any appropriate documentation in Kanto-CM as well. For some reason, after running and re-running this container a few times, the disk space has become full, and the containers are bloated

nerdctl was planned to be installed in Leda and work on top of containerd directly. If this is not properly working, it may be necessary to do the following:

vasilvas99 commented 1 year ago

Somewhat equivalent would be (removes all images used and used):

IMAGES=$(ctr --namespace kanto-cm image ls | awk 'NF && NR>1 { print $1}')

for image in ${IMAGES}; do
    ctr --namespace kanto-cm image rm $image
done
vasilvas99 commented 1 year ago

Adding the more user friendly nerdctl is also an option ( binary size is ~8MB) but we would have to: