在Mac版Docker中,如何解决Docker.qcow2的大小限制? [英] How do you get around the size limitation of Docker.qcow2 in the Docker for Mac?

查看:1014
本文介绍了在Mac版Docker中,如何解决Docker.qcow2的大小限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大型(100gb +)数据库,我正在尝试使用官方Postgres映像来运行.

I have a large (100gb+) database that I'm trying to run with the official postgres image.

我无法将数据存储在Docker卷中,因为Docker for Mac中的~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2文件的大小限制约为60gb.

I can't store the data in a docker volume because the ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2 file in Docker for Mac has a size limitation of about 60gb.

我不愿意将主机目录挂载为卷,因为已挂载的主机目录卷中的文件访问比常规卷慢得多.

I'm hesitant to mount a host directory as a volume because file access in mounted host directory volumes is much slower than regular volumes.

这些是一些有用的链接,可详细介绍这些问题:

These are some useful links that go into more detail on these issues:

  • 讨论了Docker.qcow2文件的大小限制
  • 还讨论了Docker.qcow2文件
  • 讨论了已安装的主机目录卷速度问题
  • 提供了有关如何更换的漂亮说明Docker.qcow2文件中的文件可能会变大
  • 讨论了Docker.qcow2文件如何在其内容被删除时不收缩(此没有直接关系,但会使问题进一步复杂化
  • This discusses the size limitation of the Docker.qcow2 file
  • This also discusses the size limitation of the Docker.qcow2 file
  • This discusses the mounted host directory volume speed issue
  • This gives a nice description of how to replace the Docker.qcow2 file with a file that can grow larger
  • This discusses how the Docker.qcow2 file doesn't shrink as its contents are removed (this isn't directly related, but can further complicate the problem)

你们都只是吃掉速度损失并挂载主机目录吗?您是否手动创建了一个可以随qemu增大而增大的qcow2文件(如果执行此操作,是否需要在两次升级之间维护该文件)?您还可以采取其他措施来解决此问题吗?

Do you all just eat the speed loss and mount a host directory? Do you manually create a qcow2 file that can grow larger with qemu (if you do this, do you need to maintain this file between upgrades)? Do you do something else to handle this issue?

推荐答案

磁盘"->磁盘映像大小"中设置该限制.

Docker for Mac 18.06 switches from the qcow2 file format to the raw file format, which improves speed and disk usage. The core issue still persists, in that Docker has a limited amount of space that it can use for all of its data. However, you can now set what that limit is within Preferences -> Disk -> Disk image size.

Docker for Mac版本

Docker for Mac version 17.12 was the first version to introduce the raw file format, but there were some bugs in the initial release that caused them to remove it as a feature temporarily. You can search that page for 'raw' to look back through the feature's history.

有一个很好的说明

There's a great note here about how Docker for Mac reports its disk usage...

这将显示逻辑大小:

ls -alh ~/Library/Containers/com.docker.docker/Data/vms/0/Docker.raw

这将显示物理尺寸:

du -h ~/Library/Containers/com.docker.docker/Data/vms/0/Docker.raw

这篇关于在Mac版Docker中,如何解决Docker.qcow2的大小限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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