尝试使用docker-compose文件将nfs驱动器安装到docker容器时,权限被拒绝的错误。
此错误仅在运行Docker for Windows时适用。我能够在Ubuntu主机上成功安装驱动器。
docker-compose文件
version: '2'
services:
builder:
image: some_image
ports:
- "8888:8080"
volumes:
- "nfsmountCC:</container/path>"
volumes:
nfsmountCC:
driver: local
driver_opts:
type: nfs
o: addr=<nfs_IP_Address>
device: ":</nfs/server/dir/path>"
适用于Windows的Docker产生
ERROR: for test_1 Cannot start service builder: b"error while mounting volume '/var/lib/docker/volumes/test-master_nfsmountCC/_data': error while mounting volume with options: type='nfs' device=':</nfs/server/dir/path>' o='addr=<nfs_IP_Address>': permission denied"
答案 0 :(得分:0)
以下内容适用于Windows 7上的Docker Toolbox,它从Ubuntu服务器上挂载了NFS卷:
NFS服务器端:
Docker客户端:在NFS卷定义中添加 hard 和 nolock 选项
version: '3.7'
services:
builder:
image: some_image
ports:
- "8888:8080"
volumes:
- "nfsmountCC:</container/path>"
volumes:
nfsmountCC:
driver: local
driver_opts:
type: nfs
o: "addr=<nfs_IP_Address>,rw,hard,nolock"
device: ":</nfs/server/dir/path>"