简体   繁体   中英

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

I created a "mysql" service with docker-compose with a nfs volume. 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

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. 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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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