Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.1K
Views
Using Docker-Compose with storage options (size)

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
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Try this:

storage_opt:
  size: '1G'

as in https://docs.docker.com/compose/compose-file/compose-file-v2/

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!