I can apply disk size quota with "--storage-opt size=1536M" argument when working under devicemapper. For example:
docker run -dt --name testing --storage-opt size=1536M ubuntu
the problem is, how can I do this by using docker-compose, via a compose *.yml file.
thanks.
AN ALTERNATIVE SOLUTION:
Use devicemapper as default storage driver for Docker and set basesize for every container.
To use devicemapper as the default:
1) apt-get install lvm2 thin-provisioning-tools
2) change /etc/default/docker as this:
--storage-driver devicemapper --storage-opt dm.basesize=3G
3) do these one by one:
systemctl stop docker
systemctl daemon-reload
rm -rf /var/lib/docker
systemctl start docker
4) now your containers have only 3GB space. In addition, you can define vol. space when using RUN command with devicemapper (size must be equal or bigger than basesize). For eg:
docker run --storage-opt size=1536M ubuntu
Try this:
as in https://docs.docker.com/compose/compose-file/compose-file-v2/