【docker系列】 通俗易懂的讲解如何配置基于docker容器的springCloud微服务的磁盘使用空间大小,包懂包会

官网找到,有个属性,可以用来配置容器大小

  • 在创建容器的时候使用参数--storage-opt size=10G来设置改容器的 rootfs 大小。

官方文档如下:

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 devicemapperbtrfsoverlay2windowsfilter and zfs graph drivers. For the devicemapperbtrfswindowsfilter 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 than the backing fs size.

谷歌翻译:

设置每个容器的存储驱动程序选项🔗

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

此(大小)将允许在创建时将容器rootfs大小设置为120G。此选项仅适用于devicemapperbtrfsoverlay2, windowsfilterzfs图形驱动程序。对于devicemapperbtrfswindowsfilterzfs图形驱动程序,用户无法设置比默认BaseFS 小的size对于overlay2存储驱动程序,只有在支持fs xfs并通过pquotamount选项进行安装的情况下,size选项才可用
在满足前面
overlay2条件下,用户可以设置任意比 backing fs size 小的值

解释一下:
默认情况下,每个 Docker 容器都有 10G 的存储空间,当超出该大小时,容器就会出现问题。那么修改容器大小,有两个方向,一个是比10G 大【即驱动程序为devicemapperbtrfswindowsfilterzfs】,一个是比10G小【即驱动程序为overlay2,且只有在支持fs xfs并通过pquotamount选项进行安装的情况下】。当然,默认的存储空间,也是可以修改的【文末介绍】。

查看docker的 驱动程序类型:docker info

  • 7
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值