大网数据广告活动
服务器运维问答

In Docker 17, how is disk space allocated for containers?

· 52CE 我爱测

There are various internet resources that suggest that, by default, docker containers are limited to 10g. However, those explanations go along with an indication that docker system info will show the limit. I've got docker versio…

问题原文

原帖链接 · bmargulies · CC BY-SA 3.0

There are various internet resources that suggest that, by default, docker containers are limited to 10g. However, those explanations go along with an indication that docker system info will show the limit. I've got docker version 17.05.0-ce, and docker system info shows no such limit, which suggests to me that the situation has changed. I've got a build that failed with 'out of space' on file system operations in the container. So, where is the space that I'm out of, and how do I allocate more of it? docker info shows aufs, so is the disk space sitting on the /var file system?

社区高分解答

原帖链接 · duct_tape_coder · CC BY-SA 4.0

I'll add for anyone looking for Windows information:

By default, volumes are 20GB and can be changed with --storage-opt "size=50GB".

Source: https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-containers/container-storage

Image size

A common pattern for Windows applications is to query the amount of free disk space before installing or creating new files or as a trigger for cleaning up temporary files. With the goal of maximizing application compatibility the C: drive in a Windows container represents a virtual free size of 20GB. Some users may want to override this default and configure the free space to a smaller or larger value, this can be accomplished though the “size” option within the “storage-opt” configuration. Examples

Command line: docker run --storage-opt "size=50GB" microsoft/windowsservercore:1709 cmd

Docker Configuration File:

"storage-opts": [
    "size=50GB"
  ]

Note that this method works for docker build. See the configure docker document for more details on modifying the docker configuration file.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-09-05)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。