这是一个完整的例子:

直接上操作过程

开启nfs

sudo nfsd enable
sudo nfsd start

编辑nfs配置(关键处理)

sudo vim /etc/nfs.conf

加入以下配置

nfs.server.mount.require_resv_port = 0 
nfs.server.require_resv_port=0

写入nfs开启目录

sudo vim /etc/exports

加入以下配置

/System/Volumes/Data/Software/Project/pipi -alldirs -rw -maproot=root:wheel

docker-composer.yml内容
复制代码

version: '3' 

services:
  php74fpmdev:
    image: ppwang/fpm74dev:2.0.0
    container_name: php74fpmdev
    ports: 
      - 9740:9740
    networks:
      # create the docker network first: docker network create local_default_network
      - local_default_network
      # create the docker network first: docker network create pp_service_network
      - pp_service_network
    volumes:
      - /System/Volumes/Data/Software/Project/docker/log/php-fpm-74:/var/log/php
      - data-volume:/System/Volumes/Data/Software/Project/pipi
    stdin_open: true
    tty: true
    privileged: true

networks:
  local_default_network:
    external: true
  pp_service_network:
    external: true

volumes:
  data-volume:
    driver: local
    driver_opts:
      type: "nfs"
      o: "addr=192.168.56.1,nolock,soft,rw"
      device: ":/System/Volumes/Data/Software/Project/pipi"
文档更新时间: 2020-06-28 01:22   作者:月影鹏鹏