docker - 重新启动后 Direct-LVM 停止工作

标签 docker

为了在生产环境中运行 Docker,我按照 https://docs.docker.com/engine/userguide/storagedriver/device-mapper-driver/#configure-direct-lvm-mode-for-production 中的步骤进行操作。

一切似乎都运行良好。但是,如果我出于某种原因重新启动,一切都会搞砸。即使我从 /var/lib/docker 中删除所有内容并运行 lvremove、vgremove 和 pvremove,它仍然显示 Error starting daemon: error initializing graphdriver: devmapper:无法取得已经使用过数据 block 的瘦池(docker-thinpool)的所有权,拒绝启动。

我知道必须有一些文档来说明如何使 direct-lvm 设置在重新启动时保持不变。某些东西会在重新启动后自动恢复设置。我找不到。

那么如何实现我的 direct-lvm 设置的持久性?

最佳答案

bug report 中埃里克·帕里斯 说:

IF you are using device mapper (instead of loopback) /var/lib/docker contains metadata informing docker about the contents of the device mapper storage area. If you delete /var/lib/docker that metadata is lost. Docker is then able to detect that the thin pool has data but docker is unable to make use of that information. The only solution is to delete the thin pool and recreate it so that both the thin pool and the metadata in /var/lib/docker will be empty.

由于您提到的文档措辞,我遇到了同样的问题。有步骤 rm -rf/var/lib/docker.bk 直到那时我才删除了原始文件,导致失败。

使用 pvremove -ff/dev/sda2(我的 lvm 驱动器)并重新创建、删除 lvm 分区中的签名,它对我有用。

我认为根据您的设置,它应该已经是持久的。

对我来说发生了另一个错误,重启后 lsblk 没有显示我的 lvm 卷,也没有显示 ls/dev/mapper。我正在使用 Ubuntu 和 commit message说它的默认设置不(完全?)支持精简配置。在 sudo apt-get install thin-provisioning-tools 命令 sudo vgchange -ay docker 以及重新启动对我有用。

关于docker - 重新启动后 Direct-LVM 停止工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40162022/

相关文章:

docker - Kubernetes VolumeMount 路径包含时间戳

symfony - fedora中用于docker的setfacl权限以获取symfony缓存

python - 哪种方式最适合运行后台进程?

r - 为什么 R 代码可以在本地工作,但不能在 Docker 中运行?

linux - linux 上需要 docker-machine 吗?

java - 使用相同的镜像名称更新 kubernetes 部署

javascript - 如何POST到外部IP?

google-app-engine - 如何在 App Engine Flexible 中更改/dev/shm 的大小

docker - 使用 CWL(通用工作流语言)将目录挂载到 docker 容器

laravel - 我如何让它在 docker 环境中工作 - 缺少 ext-zip 扩展