[Docker] macOS Catalina下,docker-compose关联nfs

本来,是不需要写这篇文章的,但是,macOS Catalina实在是太坑爹了,改了权限,又迁移了你的数据到 /System/Volumes/Data 下面,导致一堆问题

参考文章:

开启 Mac 上的 NFS 服务

Catalina docker NFS permission denied

NFS With Docker on macOS Catalina

 

直接上操作过程

开启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"

 

posted @ 2020-05-28 21:01  DavidHHuan  阅读(691)  评论(0编辑  收藏  举报