Docker使用扩展盘存储文件

307 阅读1分钟

最近想使用docker运行些临时demo程序,奈何本地的磁盘快满了,于是找了个移动硬盘外挂扩容。

下载了最新的docker desktop后,修改daemon.json文件

{
"data-root": "/Volumes/PSSD/docker-root"
}

发现启动不了,排查日志Library/Containers/com.docker.docker/Data/log/vm/dockerd.log

failed to start daemon: error initializing graphdriver: error changing permissions on file for metacopy check: chmod /host_mnt/Volumes/PSSD/docker-root/metacopy-check1263895717/merged/f: read-only file system

查看目录metacopy-check1263895717/merged/f权限被重置过,应该graphdriver相关的问题, 于是爬到官网发现graphdriver为废弃功能,而且版本v27.0弃用到v28.0删除,看了下我下载的v27.1,刚好中招

Graphdriver plugins are an experimental feature in Docker that allow extending the Docker Engine with custom storage drivers for storing images and containers. However, this feature has been deprecated in Docker release v27.0 and is disabled by default in the same release. It is targeted for removal in Docker release v28.0.

An environment variable `DOCKERD_DEPRECATED_GRAPHDRIVER_PLUGINS` is provided in v27.0 to re-enable the feature. This environment variable must be set to a non-empty value in the daemon's environme成nt. However, this environment variable, along with support for graphdriver plugins, will be removed in v28.0.

Users of this feature are recommended to instead configure the Docker Engine to use the containerd image store and a custom snapshotter.

于是到官网下载了老版本v24.0,重新配置外挂路径,启动正常。

参考: