Hello everyone,
I’m trying to work with NFS volume but I’m getting the following error:
renansantos@Supports-MacBook-Pro myrepo % docker-compose up
Creating my-container ... error
ERROR: for my-container Cannot create container for service my-container: failed to mount local volume: mount :/Users/renansantos/Git/myrepo/var/lib/docker/volumes/myrepo/_data, data: addr=127.0.0.1,nolock,hard,nointr,nfsvers=3: connection refused
ERROR: for my-container Cannot create container for service my-container: failed to mount local volume: mount :/Users/renansantos/Git/myrepo/var/lib/docker/volumes/myrepo/_data, data: addr=127.0.0.1,nolock,hard,nointr,nfsvers=3: connection refused
ERROR: Encountered errors while bringing up the project.
renansantos@Supports-MacBook-Pro myrepo %
My docker-compose.yml
version: '3'
services:
my-container:
container_name: my-container
image: node:16-alpine
platform: linux/x86_64
volumes:
- "nfsmount:/usr/local/app"
working_dir: /usr/local/app
entrypoint: 'sh'
command: '-c "yarn && yarn dev"'
volumes:
nfsmount:
driver: local
driver_opts:
type: nfs
o: addr=localhost,rw,nolock,hard,nointr,nfsvers=3
device: ":${PWD}"
Content from /etc/exports, my user id is 502.
/Users -alldirs -mapall=502:20 localhost
/etc/nfs.conf
nfs.server.mount.require_resv_port = 0
nfsd is running
renansantos@Supports-MacBook-Pro bin % nfsd status
nfsd service is enabled
nfsd is running (pid 2581, 8 threads)
renansantos@Supports-MacBook-Pro bin %
I’m on macOS Monterey 12.3(Chip Apple M1) using the last version from Docker Desktop, I tested changing the nfs version to 4 but it didn’t work.
Also, I’ve added full disk access for Docker and Docker-compose in security and privacy.
Do you have any idea how I can fix it?
Thanks!