Docker Devmapper空间问题 - 增加大小

时间:2017-03-15 15:43:17

标签: linux docker

我遇到与space issue on docker devmapper and CentOS7

相同的问题

它只指定清理,但不指定我如何增加空间,我没有任何图像可以清理。我用dm.min_free_space尝试了几件事,但没有任何效果,并希望增加空间。

OS Version / build:Red Hat Enterprise Linux Server 7.3(Maipo)

应用版本:

Client:
 Version:         1.12.6
 API version:     1.24
 Package version: docker-common-1.12.6-11.el7.centos.x86_64
 Go version:      go1.7.4
 Git commit:      96d83a5/1.12.6
 Built:           Tue Mar  7 09:23:34 2017
 OS/Arch:         linux/amd64

Server:
 Version:         1.12.6
 API version:     1.24
 Package version: docker-common-1.12.6-11.el7.centos.x86_64
 Go version:      go1.7.4
 Git commit:      96d83a5/1.12.6
 Built:           Tue Mar  7 09:23:34 2017
 OS/Arch:         linux/amd64

重现的步骤

我目前没有正在运行的容器,并且有一些与Kubernetes有关的Docker镜像将由Kubernetes服务使用。

sudo docker ps -a
    CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
    [kubeuser4@kubenode4 Employee]$ sudo docker images
    REPOSITORY                                            TAG                 IMAGE ID            CREATED             SIZE
    docker.io/busybox                                     latest              00f017a8c2a6        5 days ago          1.11 MB
    registry.access.redhat.com/rhel7/pod-infrastructure   latest              34d3450d733b        6 weeks ago         205 MB
    docker.io/java                                        8                   d23bdf5b1b1b        8 weeks ago         643.1 MB
    gcr.io/google_containers/heapster_grafana             v2.6.0-2            b43443930626        12 months ago       230 MB

当我尝试创建需要使用的应用程序的docker镜像时,我收到以下错误。

devmapper: Thin Pool has 8783 free data blocks which is less than minimum required 163840 free data blocks. Create more free space in thin pool or use dm.min_free_space option to change behavior

我尝试了其他论坛中提到的清理工作,但没有多大帮助并得到同样的错误。当我尝试使用这个sudo docker --storage-opt dm.min_free_space = 0%运行时,似乎它作为一个守护进程启动,但它仍然失败了另一个错误“docker-runc没有安装在系统上”而且我也不想要将其作为守护进程运行。

以下是一些命令输出

sudo dmsetup status
localvg00-lv_home: 0 20971520 linear
localvg00-lv_home: 20971520 20971520 linear
docker-251:5-134039-pool: 0 209715200 thin-pool 924 848/524288 1629226/1638400 - rw discard_passdown queue_if_no_space
localvg00-lv_tmp: 0 4194304 linear
localvg00-lv_swap: 0 8388608 linear
localvg00-lv_root: 0 2097152 linear
localvg00-lv_root: 2097152 20971520 linear
localvg00-lv_usr: 0 16777216 linear
localvg00-lv_var: 0 8388608 linear
localvg00-lv_var: 8388608 62914560 linear

sudo docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 4
Server Version: 1.12.6
Storage Driver: devicemapper
 Pool Name: docker-251:5-134039-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: 106.8 GB
 Data Space Total: 107.4 GB
 Data Space Available: 601.2 MB
 Metadata Space Used: 3.473 MB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.144 GB
 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.135-RHEL7 (2016-11-16)
Logging Driver: journald
Cgroup Driver: systemd
Plugins:
 Volume: local
 Network: overlay null bridge host
Swarm: inactive
Runtimes: runc docker-runc
Default Runtime: docker-runc
Security Options: seccomp
Kernel Version: 4.1.12-61.1.28.el7uek.x86_64
Operating System: Oracle Linux Server 7.3
OSType: linux
Architecture: x86_64
Number of Docker Hooks: 2
CPUs: 2
Total Memory: 7.545 GiB
Name: kubenode4

我还尝试在我的linux机器上增加所有物理卷大小和逻辑卷大小(lv_var),但它仍然无法正常工作。

sudo lvs
[sudo] password for kubeuser4:
  LV      VG        Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lv_home localvg00 -wi-ao---- 20.00g
  lv_root localvg00 -wi-ao---- 11.00g
  lv_swap localvg00 -wi-ao----  4.00g
  lv_tmp  localvg00 -wi-ao----  2.00g
  lv_usr  localvg00 -wi-ao----  8.00g
  lv_var  localvg00 -wi-ao---- 34.00g


 sudo ls -lsh /var/lib/docker/devicemapper/devicemapper/data
2.3G -rw------- 1 root root 100G Mar 14 22:16 /var/lib/docker/devicemapper/devicemapper/data

有人请让我知道如何做到。

谢谢,

2 个答案:

答案 0 :(得分:1)

出于某些原因,最好远离设备映射器。

回送不可恢复存储问题中的

devicemapper:https://github.com/docker/docker/issues/3182“不建议将devicemapper用于生产用途”。

我发现很容易切换到叠加存储驱动程序,YMMV当然但希望不要太多。 'rm -rf / var / lib / docker'在切换时有些可选,但很容易,我强烈推荐它,只要你可以加载你的图像。http://www.projectatomic.io/blog/2015/06/notes-on-fedora-centos-and-docker-storage-drivers/

systemctl stop docker
rm -rf /var/lib/docker

# if these files do not already exist . . . create them, otherwise you need to edit by hand, you can also just add -s overlay in the systemctl docker script
ls /etc/sysconfig/docker /etc/sysconfig/docker-storage
[[ $? != 0 ]] && {
    echo OPTIONS='--selinux-enabled=false' > /etc/sysconfig/docker
    echo "DOCKER_STORAGE_OPTIONS= -s overlay" > /etc/sysconfig/docker-storage
}
systemctl start docker
systemctl status docker
docker images

更多阅读: https://docs.docker.com/engine/userguide/storagedriver/selectadriver/ https://integratedcode.us/2016/08/30/storage-drivers-in-docker-a-deep-dive/

答案 1 :(得分:0)

能够让它运作并在

中提到它

https://forums.docker.com/t/devmapper-space-issue/29786/3