简体   繁体   English

Docker nfs volume mysql - 如何修复:“无法复制文件信息”

[英]Docker nfs volume mysql - How to fix: “failed to copy file info”

I created a "mysql" service with docker-compose with a nfs volume. 我创建了一个带有nfs卷的docker-compose的“mysql”服务。 The service does not start and gives the following error: 该服务无法启动并给出以下错误:


"failed to copy file info for /var/lib/docker/volumes/db_data/_data: failed to chown /var/lib/docker/volumes/db_data/_data: lchown /var/lib/docker/volumes/db_data/_data: operation not permitted" 


I tried with "couchdb" but it has the same problem 我试过“couchdb”,但它有同样的问题

below is a piece of example code: 下面是一段示例代码:

version: "3.7"
networks:
  web:
    external: true
services:
  db:
    image: mysql:5.7
    networks:
      - web
    environment:
      MYSQL_ROOT_PASSWORD: xxxxxx
      MYSQL_DATABASE: xxxxxx
      MYSQL_USER: xxxxxx
      MYSQL_PASSWORD: xxxxxx
    volumes:
      - db_data:/var/lib/mysql
volumes:
  db_data:
    driver_opts:
      type: nfs
      o: addr=x.x.x.x,nolock,soft,rw
      device: :/var/nfs/db_data

What is the correct and best way to make it work? 使它工作的正确和最佳方法是什么?

Try to fix it from the server side! 尝试从服务器端修复它! On the NFS server, check the "/etc/exports" file. 在NFS服务器上,检查“/ etc / exports”文件。 You should have something like this: 你应该有这样的东西:

/var/nfs/db_data x.x.x.x/24(rw,sync,no_subtree_check)

Try adding the "no_root_squash" option: 尝试添加“no_root_squash”选项:

/var/nfs/db_data x.x.x.x/24(rw,sync,no_root_squash,no_subtree_check)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM