将 Docker 存储移动到新的(加密)位置

将 Docker 存储移动到新的(加密)位置

我正在尝试移动 docker 镜像存储。

操作系统 Linux Mint 18.3

我尝试了多种方法,包括:

  • 守护进程配置文件 /etc/docker/daemon.json { "graph": "/new/dir/docker"}

  • 修改DOCKER_OPTS( "-g /new/dir/docker")

  • 甚至docker.service使用上面的选项更改文件

我还将原始/var/lib/位置与新位置同步。重新加载守护程序并尝试启动 docker 服务后,我通常会收到此警告:

警告:docker.service 在磁盘上已更改。运行“systemctl daemon-reload”以重新加载单元。docker.service 的作业失败,因为控制进程退出并显示错误代码。有关详细信息,请参阅“systemctl status docker.service”和“journalctl -xe”。

systemctl status docker.service给出这个:

● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2018-02-02 17:04:31 CET; 7min ago
  Docs: https://docs.docker.com
Process: 6941 ExecStart=/usr/bin/dockerd -g /new/dir/docker -H fd:// (code=exited, status=1/FAILURE)
Main PID: 6941 (code=exited, status=1/FAILURE)

Feb 02 17:04:30 systemd[1]: Starting Docker Application Container Engine... 
Feb 02 17:04:30 dockerd[6941]: time="2018-02-02T17:04:30.429876920+01:00" level=info msg="libcontainerd: new containerd process, pid:  
Feb 02 17:04:31 dockerd[6941]: time="2018-02-02T17:04:31.449062453+01:00" level=error msg="'overlay2' is not supported over <unknown>" 
Feb 02 17:04:31 dockerd[6941]: time="2018-02-02T17:04:31.449096454+01:00" level=error msg="[graphdriver] prior storage driver overlay2 
Feb 02 17:04:31 dockerd[6941]: Error starting daemon: error initializing graphdriver: backing file system is unsupported for this graph driver 
Feb 02 17:04:31 systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE 
Feb 02 17:04:31 systemd[1]: Failed to start Docker Application Container Engine. 
Feb 02 17:04:31 systemd[1]: docker.service: Unit entered failed state. 
Feb 02 17:04:31 systemd[1]: docker.service: Failed with result 'exit-code'. Warning: docker.service changed on disk. Run 'systemctl daemon-reload' to reload units.

所以在我看来,它正在尝试使用此分区上的文件系统不支持的图形驱动程序。它是一个 ext4 格式的分区,位于原始位置,但这个分区是加密的。加密是否真的会导致 docker 存储出现问题?如果是真的,我应该使用哪个驱动程序?不同驱动程序的缺点是什么?

--

编辑

当尝试将驱动程序切换到 devicemapper 时,重新启动后,带有元数据的 devicemapper 目录出现在我的新目录中,并且它迅速增长到巨大的大小,直到它占用整个磁盘(一旦我让该进程运行直到它增长到 65 gb,然后我不得不手动终止它,ctrl + c 不起作用)

编辑2

似乎它永远无法与 ecryptfs 一起工作https://github.com/moby/moby/issues/22577#issuecomment-223067996

相关内容