Created
May 21, 2020 11:13
-
-
Save devops-school/471f0d11c49142c61b3fae5eb91caf0f to your computer and use it in GitHub Desktop.
How to specify the size limit while creating the docker volume?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# docker -v | |
Docker version 19.03.9, build 9d988398e7 | |
# docker volume create -h | |
Flag shorthand -h has been deprecated, please use --help | |
Usage: docker volume create [OPTIONS] [VOLUME] | |
Create a volume | |
Options: | |
-d, --driver string Specify volume driver name (default "local") | |
--label list Set metadata for a volume | |
-o, --opt map Set driver specific options (default map[]) | |
Docker Command Example | |
Some of the storage driver plugins which is used for limiting a volume size are | |
- flocker | |
- local | |
- convoy | |
Here is example command provided in the documentation to specify the same | |
$ docker volume create --driver flocker -o size=20GB my-named-volume | |
$ docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 | |
$ docker volume create --driver local --opt type=btrfs --opt device=/dev/sda2 | |
$ docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 foo | |
$ docker volume create --driver convoy --opt size=100m test | |
Docker Compose Example | |
volumes: | |
tmpfs: | |
# For details, see: | |
# https://docs.docker.com/engine/reference/commandline/volume_create/#driver-specific-options | |
driver: local | |
driver_opts: | |
o: "size=$TMPFS_SIZE" | |
device: tmpfs | |
type: tmpfs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment