Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pruning container garbage and other leftovers #42

Open
mikehaller opened this issue Jun 6, 2023 · 2 comments
Open

Pruning container garbage and other leftovers #42

mikehaller opened this issue Jun 6, 2023 · 2 comments

Comments

@mikehaller
Copy link
Contributor

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:

  • Adapt the kanto-cm configuration to clean up and throw away garbage containers much faster, esp. during development
  • Add a container-pruning utility to leda-utils
@vasilvas99
Copy link
Contributor

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
Copy link
Contributor

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

  • Set the default namespace to kanto-cm as not to confuse users
  • Explain that the kanto-cm ID is the container name in ctr/nerdctl terms, so they would have to resolve that themselves in cases where id != name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants