How can I monitor docker volume usage?

HOW TO -️ October 18, 2021

I'm planning to automate docker activities using python. However, I couldn't find any efficient command for monitoring docker volume. So now I wish to use shell commands for that and later it can be converted using subprocess in python.

My requirement is when I give a volume name then I need the used space, free space, and total space of that volume for finding the storage threshold of the same.

I tried using the docker system df -v But it showing all details.

For example, I give the volume name as my_volume then I need storage details of the same only. Hope everyone understood my requirement and excepting a helping hand from someone.


Hi. Do you mean attached volumes? Are you want to monitor container's native block device provided with OverlayFS?