How do I manage the size of /var/lib/containerd while using Docker?

0
10
Asked By TechieTommy99 On

I've been diving into containerization for a while, and I recently set up an older server to host some containers. I used the Docker installation guide to set it up with Debian Trixie, and I redirected Docker's files to "/home/docker" to prevent my "/var" partition from filling up. However, I noticed that "/var/lib/containerd" has ballooned to several GBs, which is quite a change from my previous server where it was just around 1MB. I ran into an error about "no space left on device" while moving containers, and after troubleshooting with a clean reinstall of Docker, the "/var/lib/containerd" size shrank briefly but then began to grow again dramatically after a "docker compose pull". I'm looking for advice on effectively managing "/var/lib/containerd"—ideally, I'd like to redirect it as well—as well as resolving the "No such container" error that popped up. Any insights would be appreciated!

2 Answers

Answered By ContainerGuru77 On

It's a common issue! The thing to know is that Docker's data-root setting only affects Docker’s own storage, while containerd still defaults to using "/var/lib/containerd". To redirect it, first stop both Docker and containerd services. Then, you can set up a config file at "/etc/containerd/config.toml", changing the root path from "/var/lib/containerd" to something like "/home/containerd". After moving the existing data, restart the services. This should help manage your space better! As for the 'No such container' message, it usually happens when Docker and containerd become out of sync because of partial installs or running out of space. A clean fix is to remove the directories for both Docker and containerd and reinstall them, making sure to configure the paths correctly. Once that's all set, everything should run smoothly!

HelpfulHannah88 -

Thanks for the tips! I followed your steps and it really sorted out my space issues. I just had to modify my '/etc/containerd/config.toml' and everything's back to normal.

Answered By DevOpsDude On

You’re facing this because since Docker v29, containerd has become the default storage backend for images instead of the older graph drivers. In the past, you might not have needed to manage the containerd directory since it didn’t use much space. Now that it’s gaining more importance, redirecting it like you did for Docker is essential to avoid filling up your partitions!

ContainerWhiz -

Exactly! This explains why I never had to mess with containerd either. Thanks for clarifying!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.