在 macOS 上增加 Docker 镜像的默认磁盘空间

4

我在 macOS Sierra (10.12.2) 上安装了 Docker v1.13.0。

对于所有创建的镜像,/ 的磁盘空间都分配了 63GB,如下面截图所示:

enter image description here

问题:我该如何将可用空间从 63GB 增加到 150GB?

Docker 信息:

Containers: 1
 Running: 1
 Paused: 0
 Stopped: 0
Images: 3
Server Version: 1.13.0
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge host ipvlan macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 03e5862ec0d8d3b3f750e19fca3ee367e13c090e
runc version: 2f7393a47307a16f8cee44a37b262e8b81021e3e
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.4-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.65 GiB
Name: moby
ID: PUCA:LCD6:6LUP:IQ37:AZAX:GVW7:HVY5:MVOW:7WSJ:QUKO:QKCK:Q5EN
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 25
 Goroutines: 42
 System Time: 2017-01-28T14:50:13.838004112Z
 EventsListeners: 2
No Proxy: *.local, 169.254/16
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
 127.0.0.0/8

~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/的输出为:

total 304
drwxr-xr-x  12 cvb  staff   408B Jan 28 13:00 .
drwxr-xr-x  22 cvb  staff   748B Jan 28 13:00 ..
-rw-r--r--   1 cvb  staff    64K Jan 28 13:00 console-ring
-rw-r--r--   1 cvb  staff    64K Jan 28 12:59 console-ring.0
-rw-r--r--   1 cvb  staff     5B Jan 28 13:00 hypervisor.pid
-rw-r--r--   1 cvb  staff     0B Jan 28 12:59 lock
drwxr-xr-x   2 cvb  staff    68B Jan 28 12:59 log
-rw-r--r--   1 cvb  staff    17B Jan 28 13:00 mac.0
-rw-r--r--   1 cvb  staff    36B Jan 28 12:59 nic1.uuid
-rw-r--r--   1 cvb  staff     5B Jan 28 13:00 pid
-rw-r--r--   1 cvb  staff    94B Jan 28 13:00 syslog
lrwxr-xr-x   1 cvb  staff    12B Jan 28 13:00 tty -> /dev/ttys000

1
“ls -lah ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux”的输出是什么? - Salem
@Salem,我已经更新了问题,并附上了目录清单。 - Cyril Deba
1
有没有办法在存储配置文件中更新容器的默认大小?https://docs.docker.com/engine/reference/commandline/dockerd#storage-opt dm.basesize - Foreever
2个回答

2
即使在1.13.0版本中,这也是一个困难的过程,可能会导致您的所有容器和镜像被清除。请按照此处的步骤进行操作:
https://github.com/docker/for-mac/issues/371#issuecomment-262826610
祝好!

1
这些容器在虚拟机内运行,因此必须增加分配给该虚拟机的磁盘大小,以便为您的容器腾出更多空间。
您是如何创建Docker主机的?使用了docker-machine还是boot2docker?
另外,将大量空间分配给容器并不是一个好的做法,您可以创建一个外部卷并将其挂载到容器内部。

我没有使用docker-machine或boot2docker,只是安装了Docker,现在需要检查这个人在安装过程中创建了什么。你说得对,分配这么多空间听起来不太好。我正在进行一个“快速且肮脏”的PoC,并提出了问题。我最终挂载了一个目录,但问题仍然存在。 - Cyril Deba
1
根据 https://docs.docker.com/docker-for-mac/,Docker for Mac 已经内置了 VirtualBox。 - Vlad
Vlad,那是错误的。链接清楚地说明它使用Hyperkit来代替VirtualBox。 - Dave L.

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接