Install docker for mac.
-
Edit
/etc/nfs.conf:nfs.server.mount.require_resv_port = 0 -
Edit
/etc/exports(create if not exist):Execute command and Put result of command execution into
/etc/exports.:for OSX Mojave and lower:
echo "$HOME -alldirs -mapall=$(id -u):$(id -g) localhost"
for OSX Catalina and higher:
echo "/System/Volumes/Data -alldirs -mapall=$(id -u):$(id -g) localhost"
-
Restart
nfsdservice:sudo nfsd restart
-
Use nfs-volume in your
docker-compose.yaml:# Add PROJECT_NAME into .env file to avoid collision with other projects volumes: app_volume: name: ${PROJECT_NAME}_app_volume driver: local driver_opts: type: nfs o: addr=host.docker.internal,rw,nolock,hard,nointr,nfsvers=3 device: ":${PWD}" # for OSX Catalina # device: ":/System/Volumes/Data${PWD}" services: php: container_name: ${PROJECT_NAME}_php image: php:7.2-fpm volumes: - app_volume:/app:rw