Centos7修改docker的Data Space Total大小

记得备份你的容器

此处就不多做介绍了

–storage-opts 参数

devicemapper文档:https://github.com/moby/moby/tree/master/daemon/graphdriver/devmapper
docker官方文档:https://docs.docker.com/engine/reference/commandline/dockerd/#options-per-storage-driver

修改docker的启动参数

停止docker,修改配置,重新加载配置

sudo systemctl stop docker
sudo vi /lib/systemd/system/docker.service

找到ExecStart=/usr/bin/dockerd
在这一行后面加上
--storage-opt dm.loopdatasize=8G --storage-opt dm.loopmetadatasize=4G --storage-opt dm.basesize=8G 即可,意思是为,设置devicemapper的data为8G,metadata为4G,镜像的大小不能大于8G

记得还要抹去现有的空间,请确保你已经完成了第一步

sudo rm -rf /var/lib/docker
sudo mkdir -p /var/lib/docker/devicemapper/devicemapper/
sudo dd if=/dev/zero of=/var/lib/docker/devicemapper/devicemapper/data bs=1M count=0 seek=8192
sudo dd if=/dev/zero of=/var/lib/docker/devicemapper/devicemapper/metadata bs=1M count=0 seek=4096

完成后运行

sudo systemctl daemon-reload
sudo systemctl start docker
docker info

查看是否设置正确,貌似比预设的大了一点点。

猜你喜欢

转载自blog.csdn.net/tinyjian/article/details/78436739