2

I am trying to create a simple hosting platform for my clients. I am deploying all of my apps via docker on a VPS behind nginx-proxy. For wordpress applications I want to be able to limit disk-space so that my clients do not use too much and affect other applications. I bind mount all volumes to a single directory so that I can back-up easily with cron.

I've change the file system to overlay2 and am on centos 7.

[root@my-ip ~]# docker info

Server:
  Containers: 12
  Running: 12
  Paused: 0
  Stopped: 0
 Images: 11
 Server Version: 19.03.1
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Native Overlay Diff: true

When I run a wordpress container with the --storage-opt size=10G I get the following error:

docker: Error response from daemon: --storage-opt is supported only for overlay over xfs with 'pquota' mount option.

This is an example of the bind mount I am using:

-v /DOCKER_VOLUMES/wordpress/appname/www/html:/var/www/html

How do I fix this? Can you please provide a full list of instructions to enable it?

2 Answers 2

2

from the Docs:

This (size) will allow to set the container rootfs size to 120G at creation time. This option is only available for the devicemapper, btrfs, overlay2, windowsfilter and zfs graph drivers. For the devicemapper, btrfs, windowsfilter and zfs graph drivers, user cannot pass a size less than the Default BaseFS Size. For the overlay2 storage driver, the size option is only available if the backing fs is xfs and mounted with the pquota mount option. Under these conditions, user can pass any size less than the backing fs size.

so the pquota should be enabled on your system

you can edit the file /etc/default/grub like so, and restart your machine:

GRUB_CMDLINE_LINUX_DEFAULT="rootflags=uquota,pquota"

and try to rerun your command with --storage-opt size=10G

2
  • I receive the same error, I even restarted the docker service.
    – Tom
    Commented Jul 29, 2019 at 6:45
  • Please restart the hole machine
    – LinPy
    Commented Jul 29, 2019 at 6:49
1

In addition with the above solution, edit the /etc/fstab to include pquota option like dev/mapper/cl-var / xfs defaults,pquota 0 0. As /var is my default docker installation location.

--storage-opt size should be less than your backing filesystem size.

Storage Quota Per Container

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Jun 1, 2023 at 5:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.