Docker Community Forums

Share and learn in the Docker community.

Limit size of container's writable layer?

I’m using Docker Swarm to launch jupyter notebook services on a worker node. I am using a bind mount to a working directory (/home/user/work), but users can still write to /home/user, which goes to the container’s writable layer. Is there a way limit the size of this writeable layer? I’ve seen references to dm.basesize, but I don’t want to limit the size of the image layer containers. I just want to limit what users can write to their writeable layer.

I know that this layer is deleted when the container is deleted, but if several users write a lot of data here at the same time it will fill up the disk.

I’m running on Centos7, Docker Server Version: 19.03.8, Storage Driver: overlay2

Thanks,
Mark

Answering my own question: xfs project quotas are a solution to limit the size of the writable overlay: https://reece.tech/posts/docker-container-size-quota/