I have an application inside a Docker container running Debian that has a feature that can import a lot of big files. The application stores the files in a folder on the host that is accessible via a bind mount from inside the container. This is a problem when a user points this import feature towards a set of files that is larger than the available storage, running out of space entirely makes the application very unhappy and I'd like to avoid that.
The problem is that it seems rather tricky to figure out the amount of free space on the correct partition from inside the container. I can execute df
inside the container and get the free space on all partitions, but I don't know which partition is the correct one. The bind mount is always at the same path internal to the container, I can't find out which path outside the container this corresponds to.
Is there a way to figure out for a specific bind mounted folder inside a Docker container how much free space is available on the partition this folder is mounted from?