linux - 如何将aufs目录下的docker镜像移动到overlay2?

标签 linux docker

我将我的 Debian 内核从 3.x 更新到 4.x。
Docker 存储变为 overlay2。

ls /var/lib/docker/ 
containers  image  network  overlay2  plugins  swarm  tmp  trust  volumes

旧的目录结构是

aufs  containers  graph  image  init  linkgraph.db  network  plugins  repositories-aufs  swarm  tmp  tmp-old  trust  volumes

我的图片在 aufs 目录中,我无法使用旧目录启动 docker 服务。如何将图像移动到 overlay2?

最佳答案

  1. 确定从 aufs 迁移到 overlayfs2 后要保存和恢复的图像。

  2. 将所有要迁移到 overlayfs 的图像导出到一个存档中 - 这样更快更高效

    sudo docker save $IMAGES -o /data/save.tar

    在这里IMAGES是包含图像名称的变量

  3. 使用以下内容创建/etc/docker/daemon.json:

    {
      "storage-driver": "overlay2"
    }
    

    [ 使用 jq 更新它请引用 https://stackoverflow.com/questions/42245288/add-new-element-to-existing-json-array-with-jq/57537190#57537190 ]

  4. 对存放docker镜像的目录进行备份并删除

    mv /var/lib/docker/images /var/lib/docker.aufs.images

  5. systemctl daemon-reload

  6. systemctl restart docker

  7. docker load < save.tar

关于linux - 如何将aufs目录下的docker镜像移动到overlay2?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44745304/

相关文章:

linux - Linux 中的 DNS 缓存

linux - Eyaml 和 Puppet

android - 识别/proc/*/maps 中的代码段的好方法

node.js - apt-get 始终安装旧版本的 node.js

清除所有内容的 Docker 命令

linux - 如何使Linux Docker镜像文件系统不区分大小写?

docker - Docker 中的 Kong DB-less

docker - 删除仅数据容器后如何重新绑定(bind)docker卷?

linux - Yocto 使用一个配方文件启用多个 systemd 服务

sql-server - 是否可以清点在 Docker 中运行的 MSSQL-Linux?