docker --storage-opt dm.basesize = 40G不起作用?

时间:2014-12-22 03:56:14

标签: docker boot2docker


我将存储切换到devicemapper,并尝试将容器的rootfs增长到40G 我将以下内容添加到/ var / lib / boot2docker / profile并重启boot2docker的VM

[/var/lib/boot2docker/profile start]<br>
\#!/bin/sh<br>
EXTRA_ARGS="--storage-opt dm.basesize=40G --storage-driver=devicemapper"<br>
[/var/lib/boot2docker/profile end]<br>

docker.log显示配置生效

[/var/lib/boot2docker/docker.log snippet start]<br>
/usr/local/bin/docker -d -D -g "/var/lib/docker" -H unix:// -H tcp://0.0.0.0:2376 **--storage-opt dm.basesize=40G --storage-driver=devicemapper** --tlsverify --tlscacert=/var/lib/boot2docker/tls/ca.pem --tlscert=/var/lib/boot2docker/tls/server.pem --tlskey=/var/lib/boot2docker/tls/serverkey.pem >> "/var/lib/boot2docker/docker.log"<br>
2014/12/22 03:33:36 docker daemon: 1.3.2 39fa2fa; execdriver: native; graphdriver: devicemapper<br>
[74c56fa4] +job serveapi(unix:///var/run/docker.sock, tcp://0.0.0.0:2376)<br>
[debug] deviceset.go:565 Generated prefix: docker-8:1-784941<br>
[debug] deviceset.go:568 Checking for existence of the pool 'docker-8:1-784941-pool'<br>
[debug] deviceset.go:587 Pool doesn't exist. Creating it.<br>
[/var/lib/boot2docker/docker.log snippet end]<br>

但是,容器的rootfs仍然绑定到20G而不是配置中显示的40G

[df -h in container start]<br>
[root@sshd ~]\# df -h<br>
Filesystem            Size  Used Avail Use% Mounted on<br>
rootfs                 **20G**  401M   19G   3% /<br>
/dev/mapper/docker-8:1-784941-8184b64c9275276c9420f5decd0b1d31dc8bce725ecbd93a918407363b45b2d3<br>
                       20G  401M   19G   3% /<br>
tmpfs                 2.0G     0  2.0G   0% /dev<br>
shm                    64M     0   64M   0% /dev/shm<br>
/dev/sda1             192G  6.9G  175G   4% /etc/resolv.conf<br>
/dev/sda1             192G  6.9G  175G   4% /etc/hostname<br>
/dev/sda1             192G  6.9G  175G   4% /etc/hosts<br>
tmpfs                 2.0G     0  2.0G   0% /proc/kcore<br>
[root@sshd ~]\#<br>

[df -h in container end]

--storage-opt dm.basesize似乎根本不起作用,我该如何解决这个问题呢?

1 个答案:

答案 0 :(得分:3)

事实证明,只有拉新图像才能使用新的dm.basesize。 它没有用,因为我使用&#34; docker load&lt; / XXX&#34;加载本地备份tar图像。