As someone new to docker world and coming from a virtual machine mindset. I downloaded a docker image for elastic search from docker hub.I am thinking about any configurations I need to do because a lot of data will be forwarded to this image. I need to be considerate about the available disk space. In a Virtual machine world, I can always add additional vhds to increase disk size etc. What's similar operation in a docker world?
Disk size of a docker image
17.1k views Asked by whoami At
2
A Docker container uses copy-on-write storage drivers such as aufs, btrfs, ... to manage the container layers. All writes done by a container are persisted in the top read-write layer. These layers (especially the write layer) are what determine a container's size.
There is a size limit to the Docker container known as base device size. The default value is 10GB. This value can be changed to allow the container to have more size using
dockerd --storage-opt dm.basesize=50G
. This will give the container a rootFS size of 50GB.However, this is not the recommended way to handle heavy write operations that increase the container size. The recommnded way to do that is using Docker volumes. Volumes are not persisted within the Docker local storage area for container layers (i.e
/var/lib/docker/<storage-driver>/...
), and are thus independent from the container's storage driver. Therefore, they do not contribute to the size of the container.There is no limits on the number of volumes a container can have. It is recommended to map directories inside the container that will grow in size into volumes.
For more info about storage drivers check About storage drivers