When you create a
docker container there is no way to allocate resources like
disco duro , etc. The only thing I have seen is how to open ports so that there is communication with the outside ( see here ) and also how to add volumes ( see here ) to store or read files.
But I have not found a way to manage the resources of a
docker container , does anyone know if that is possible? Are there default values? Do they grow automatically depending on demand? Can they be restricted?
I have searched the official documentation but have not found anything related.
What you are looking for is the reference for
run that is here . In direct response by copying the examples in the documentation:
Map RAM (memory)
With memory limit up to 300MB and without swap
$ docker run -ti -m 300M --memory-swap -1 ubuntu:14.04 /bin/bash
With limited memory and with all the swap that is available:
$ docker run -ti -m 300M ubuntu:14.04 /bin/bash
There are a multitude of other options in the documentation (limit swap, etc). Look at the reference I gave above.
Map hard drive
Since version 1.9.1. it is possible to limit the use of hard disk directly (in response to incident # 3804 where you will find the history of this functionality). I have not used it myself, but according to the documentation it would have the following form:
$ docker create -it --storage-opt size=120G ubuntu:14.04 /bin/bash [...responde con un guid del nuevo contenedor .. $ docker start -a -i [.. aqui el guid de arriba ..]