Docker – Editing Mount Options

I am adding a disk quota to my Ubuntu docker container. To add quota support, I need to edit the mount options and add usrquota as explained here:

Usually you would edit /etc/fstab and add the mount option.

  • Mounting nfs shares inside docker container
  • Creating an environmental variable within Docker container when starting up
  • How to deploy using capistrano without current release symlink?
  • docker-compose build and http_proxy
  • Docker: how to work with local files?
  • How to add volume to Docker but exclude files
  • My question, how would I add a mount option to a docker container?

  • Docker config : Celery + RabbitMQ
  • docker-compose volume on node_modules but is empty
  • Docker engine fillingup storage
  • start multiple docker containers with a single command line shell script (without docker-compose)
  • How to run HDFS cluster without DNS
  • Salt: 'dockerng' __virtual__ returned False
  • One Solution collect form web for “Docker – Editing Mount Options”

    You don’t really mount container’s disks anywhere. There is a feature request asking for setting quotas in Docker containers ( so at the moment there is no easy way.

    However, apparently there are a couple of workarounds.

    Use Device Mapper as a limit

    Docker containers have a maximum of 10GB of disk space, per container (that is the Device Mapper storage driver by default).

    So your best option is to change the default value for new containers, but then, it is my understanding you would need to rebuild the containers.

    So, if you want to enforce 5 gigabytes, you would write

    docker -d --storage-opt dm.basesize=5G


    User inside/quota outside

    The trick is create a specific user account in each container, and assign a userid for that account (and obviously run the command with that account).
    On the host, we would use setquota to limit this userid.


    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.