As the title of this question suggests I'm wanting to set max disk/memory and cpu usage for a container using docker (docker.io).
Is there a way to do this using just docker?
By default, the container can swap the same amount of assigned memory, which means that the overall hard limit would be around 256m when you set --memory 128m .
To mount a data volume to a container add the --mount flag to the docker run command. It adds the volume to the specified container, where it stores the data produced inside the virtual environment. Replace [path_in_container] with the path where you want to place the data volume in the container.
Memory/CPU
Docker now supports more resource allocation options:
Have a look at docker run --help
for more details.
If you use lxc backend (docker -d --exec-driver=lxc
), more fine grained resource allocation schemes can be specified, e.g.:
docker run --lxc-conf="lxc.cgroup.cpuset.cpus = 0,1"\ --lxc-conf="lxc.cgroup.cpu.shares = 1234"
Storage
Limiting storage is a bit trickier at the moment. Please refer to the following links for more details:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With