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: https://www.digitalocean.com/community/tutorials/how-to-enable-user-and-group-quotas

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

  • Docker, CoreOS and fleet based deployments
  • Issues with volume mounting with Docker-compose
  • microservices & service discovery with random ports
  • How stop containers run with `docker-compose run`
  • Setting up Text editor like Vim,Spacemacs to work with docker containers without installing tools on the host machine
  • Relationship between docker0, Docker Bridge Driver and Containers
  • My question, how would I add a mount option to a docker container?

  • Can not access wordpress configured in Docker even though its status is running
  • Docker SonarQube Qalityprofile
  • Backup a postgres Container with its databases
  • Can't access to docker mongo without being root
  • Unable to access Docker Nanoserver container web app
  • Docker Run Time Statistics ( Benchmarks)
  • 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 (https://github.com/docker/docker/issues/3804) 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
    

    Source

    https://goldmann.pl/blog/2014/09/11/resource-management-in-docker/#_limiting_disk_space

    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.

    Source https://github.com/docker/docker/issues/471#issuecomment-22373948

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