有没有办法选择 docker 中默认卷驱动器的命名卷的路径?

Is there a way to choose the path of named volumes with the default volume drives in docker?

在 docker 中有没有办法选择带有默认卷驱动器的命名卷的路径?

我知道我可以在每个服务中绑定挂载卷。我知道我可以在服务之外创建命名卷,并通过将它们安装在每个服务中来共享它们。但是我找不到在 select 而不是 docker 的 /var/lib/docker/volumes/.

的路径上获取数据(要共享)的方法

有人试图在同一 docker-compose 文件的两个不同容器中共享一个卷作为挂载点吗?

您不能使用内置的 docker 音量插件来做到这一点。您需要安装如下第三方插件

https://github.com/CWSpear/local-persist

curl -fsSL https://raw.githubusercontent.com/CWSpear/local-persist/master/scripts/install.sh | sudo bash

docker volume create -d local-persist -o mountpoint=/data/images --name=images

docker run -d -v images:/path/to/images/on/one/ one
docker run -d -v images:/path/to/images/on/two/ two