Reputation: 19665
With docker build
, how do I specify the maximum disk space to be allocated to the runtime container?
This StackOverflow question mentioned runtime constraints, and I am aware of --storage-opt
, but that concerns runtime parameters on dockerd
or run docker
-- and in contrast, I want to specify the limit in advance, at image build time.
(Note that I am not talking about specifying the disk footprint of the image, but rather about specifying the the maximum disk space for the container.)
Upvotes: 0
Views: 365
Reputation:
You can't do this at build time. A container's max disk space can be only limited at runtime.
Now, if you are concerned that your disk might get full due to Docker stuff (images, logs, etc), what you can do is mount /var/lib/docker
in a partition different than the main system partition, this way you know that getting out of space in docker won't crash your system. Or in case of Docker for Mac, you have a disk limit in the preferences.
Upvotes: 1