如何指定共享Docker卷的大小? [英] How specify the size of a shared Docker volume?

查看:175
本文介绍了如何指定共享Docker卷的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我想创建一个ext4类型的15GB数据量,我该怎么做?

If I would like to create a data volume of let´s say 15GB that would be of type ext4, how would I do that?

docker volume create --name vol 只会创建一个空卷。

docker volume create --opt类型= ext4 --name vol 创建一个ext4卷,但是由于ext4根据ext4的安装选项不支持它,因此我无法指定它的大小。

docker volume create --opt type=ext4 --name vol creates an ext4 volume but I cannot specify the size of it since ext4 does not support it according to the mount options of ext4.

推荐答案

可以根据size 创建docker卷时指定大小限制https://docs.docker.com/engine/tutorials/dockervolumes/ rel = noreferrer>文档

It is possible to specify the size limit while creating the docker volume using size as per the documentation

此处是示例命令指定相同文件的文档

Here is example command provided in the documentation to specify the same


docker volume create -d flocker -o size = 20GB my-named-volume

docker volume create -d flocker -o size=20GB my-named-volume

更新来自 git仓库


在Linux上的 local 驱动程序中,其接受的选项类似于linux
mount 命令:

$ docker volume create --driver local --opt type = tmpfs --opt设备= tmpfs --opt o =大小= 100m,uid = 1000

另一个例子:

$ docker volume create- -driver local --opt type = btrfs --opt device = / dev / sda2

The built-in local driver on Linux accepts options similar to the linux mount command:
$ docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000
Another example:
$ docker volume create --driver local --opt type=btrfs --opt device=/dev/sda2

这篇关于如何指定共享Docker卷的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆