Docker devicemapper存储空间

时间:2017-06-16 16:09:44

标签: linux docker containers device-mapper

移除容器时,“设备上没有剩余空间”错误。

# docker rm orientdb1
Error response from daemon: Driver devicemapper failed to remove root filesystem ba18ea8014b6024eb738502612130244ff363b433f146102c64eb2eb0f3a321c: devmapper: Error saving transaction metadata: devmapper: Error creating metadata file: open /var/lib/docker/devicemapper/metadata/.tmp636968871: no space left on device

以下是“df -kh”输出的摘录。

Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root  3.8T  3.8T   20K 100% /

以下是“du -ksh”输出的摘录。这表明使用了3.8TB。

3.8T    /var/lib/docker

这是“码头信息”输出。

# docker info
Containers: 56
 Running: 8
 Paused: 0
 Stopped: 48
Images: 18
Server Version: 1.12.0
Storage Driver: devicemapper
 Pool Name: docker-253:0-1196768-pool
 Pool Blocksize: 65.54 kB
 Base Device Size: 10.74 GB
 Backing Filesystem: xfs
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 24.51 GB
 Data Space Total: 107.4 GB
 Data Space Available: 20.48 kB
 Metadata Space Used: 29.18 MB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 20.48 kB
 Thin Pool Minimum Free Space: 10.74 GB
 Udev Sync Supported: true
 Deferred Removal Enabled: false
 Deferred Deletion Enabled: false
 Deferred Deleted Device Count: 0
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 WARNING: Usage of loopback devices is strongly discouraged for 
 production use. Use `--storage-opt dm.thinpooldev` to specify a custom 
 block storage device.
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
  Library Version: 1.02.107-RHEL7 (2016-06-09)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host overlay null
 Swarm: inactive
 Runtimes: runc
Default Runtime: runc
Security Options: seccomp
Kernel Version: 3.10.0-327.22.2.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 12
Total Memory: 251.7 GiB
Name: my-host1
ID: KTTY:PSTQ:YQSP:9KZJ:VSVU:DFUZ:CEMF:DYWQ:CA3I:6KUB:6J2J:D4NG
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: bridge-nf-call-ip6tables is disabled
Insecure Registries:
 127.0.0.0/8

想了解3.8 TB是如何从以下内容中解释的(来自“码头信息”的片段)

 Data Space Used: 24.51 GB
 Data Space Total: 107.4 GB
 Data Space Available: 20.48 kB
 Metadata Space Used: 29.18 MB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 20.48 kB
 Thin Pool Minimum Free Space: 10.74 GB

另外,如何清理/ var / lib / docker以获得一些可用空间。

2 个答案:

答案 0 :(得分:2)

我认为磁盘空间数字是针对环回驱动程序以及devicemapper在环回模式下使用的文件/ var / lib / docker / devicemapper / devicemapper / data。

要清理泊坞窗,您可以在较新版本上运行docker system prune。旧版本可以使用如下命令:

docker ps -aqf status=exited | xargs docker rm
docker images -qf dangling=true | xargs docker rmi

除此之外,您需要将容器和图片通过容器上的docker stopdocker rm和图片上的docker rmi

答案 1 :(得分:0)

要添加到BMitch的答案,您还可以使用docker volume ls -f dangling=true | xargs docker volume rm

删除悬空的卷以释放空间。