@smjain (Smjain) posted a new topic, subject "Disk quota for Docker Containers". It read:

   We run database like postgres,mysql within Docker Containers. What is the best way to assign quotas to the volumes for the same.
    
      1. Via the host using setquota and mapping to a userid
      2. Using a volume driver which can talk to Block storages like Cinder or AWS Block Storage.

After which, @nathanleclaire (Nathan Le Claire) added

    I'm not sure if this will help your use case, but `docker run` does have some knobs you can turn (flags) to control access to devices and block IO:
    [code] 
        --blkio-weight                  Block IO (relative weight), between 10 and 1000
        --blkio-weight-device=[]        Block IO weight (relative device weight)
        ....
        --device=[]                     Add a host device to the container
        --device-read-bps=[]            Limit read rate (bytes per second) from a device
        --device-read-iops=[]           Limit read rate (IO per second) from a device
        --device-write-bps=[]           Limit write rate (bytes per second) to a device
        --device-write-iops=[]          Limit write rate (IO per second) to a device
    [/code]

To which @smjain (Smjain) replied

    We are trying the uid concept for limiting disk quotas. Since Swarm is the scheduler we use, the way I am trying to tackle is that having a mapping file of uid at swarm server level, and use constraints at the docker daemon level to let swarm choose containers of a specifc UID end up going to the node and thereby quota gets applied.Thoughts/Suggestions?

So @nathanleclaire (Nathan Le Claire) replied

    smjain:
    
    > We are trying the uid concept for limiting disk quotas
    
    I don't understand. Could you explain more about what you are trying to accomplish, or point me to a link which explains this concept?

@smjain (Smjain) replied

    Hi Nathan,  
    We assign user ids to the containers. And each userid(uid) has a quota of disk on host.  
    As Swarm level we maintain a mapping of userids to the name of the docker image we want to run on a particular host with quota applied.  
    Then we use constraints at the docker daemon level (using node=the userids),so that swarm spins the containers for the specific user id on the host on which the quotas are defined for that user id.  
    Regards  
    Shashank


{'source': 'discourse', 'url': 'https://forums.docker.com/t/disk-quota-for-docker-containers/8051', 'title': 'Disk quota for Docker Containers', 'views': 7229, 'has_accepted_answer': False, 'word_count': 350, 'like_count': 0, 'reply_count': 2, 'participant_count': 2, 'posts': 5, 'tags': '', 'author': '@smjain (Smjain)', 'participants': '@smjain (Smjain), @nathanleclaire (Nathan Le Claire)', 'image_url': [None], 'created_at': '2016-03-30T12:59:32.582Z', 'last_posted_at': '2016-04-02T00:30:05.061Z'}