Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does Docker run --storage-opt size=XYZ means?

Docker run cli command has an option --storage-opt used like this:

docker run --storage-opt size=XYZ ....nginx

Does the "XYZ" size specified above refer to the CoW layer or the total size of base image and CoW layer as discussed in this link ?

like image 498
ben Avatar asked Jun 15 '17 19:06

ben


People also ask

How does storage work in docker?

Docker has two options for containers to store files on the host machine, so that the files are persisted even after the container stops: volumes, and bind mounts. Docker also supports containers storing files in-memory on the host machine. Such files are not persisted.

Which docker command is used to determine the current storage driver configured?

To see the storage driver being used, issue the docker info command.


1 Answers

From: https://docs.docker.com/engine/reference/commandline/run/#set-storage-driver-options-per-container

docker run -it --storage-opt size=120G fedora /bin/bash

This (size) will allow to set the container rootfs size to 120G at creation time. This option is only available for the devicemapper, btrfs, overlay2, windowsfilter and zfs graph drivers. For the devicemapper, btrfs, windowsfilter and zfs graph drivers, user cannot pass a size less than the Default BaseFS Size. For the overlay2 storage driver, the size option is only available if the backing fs is xfs and mounted with the pquota mount option. Under these conditions, user can pass any size less then the backing fs size.

like image 195
Ricardo Branco Avatar answered Sep 30 '22 21:09

Ricardo Branco