Nginx container won’t build after running docker-compose up (volume device issue)

I’m currently writing a Docker Compose YAML file to run services like a Node.js app, MongoDB, and Nginx. While the app and db build, the webserver is giving me the error:

ERROR: for webserver Cannot start service webserver: b’Mounts denied: rnThe path /User/alan/testrnis not shared from OS X and is not known to Docker.rnYou can configure shared paths from Docker -> Preferences… -> File S

I’m not too sure why it’s giving me this error but I know that it’s related to the volumes/web-root/driver_opts/device volume.

Can anyone point me in the right direction?

docker-compose.yml:

version: '3'

services:
  nodejs:
    build: 
      context: .
      dockerfile: Dockerfile
    image: nodejs
    container_name: nodejs
    restart: unless-stopped
    env_file: .env
    environment:
      - MONGO_USERNAME=$MONGO_USERNAME
      - MONGO_PASSWORD=$MONGO_PASSWORD
      - MONGO_HOSTNAME=db
      - MONGO_PORT=$MONGO_PORT
      - MONGO_DB=$MONGO_DB 
    ports:
      - "81:8080"
    depends_on: 
      - db
    volumes:
      - .:/home/node/app
      - node_modules:/home/node/app/node_modules
    networks:
      - app-network
    command: ./wait-for.sh db:27017 -- /home/node/app/node_modules/.bin/nodemon index.js

  db:
    image: mongo:4.1.8-xenial
    container_name: db
    restart: unless-stopped
    env_file: .env
    environment:
      - MONGO_INITDB_ROOT_USERNAME=$MONGO_USERNAME
      - MONGO_INITDB_ROOT_PASSWORD=$MONGO_PASSWORD
    volumes:  
      - dbdata:/data/db   
    networks:
      - app-network  
    ports:
      - "27017:27017"

  webserver:
    image: nginx:mainline-alpine
    container_name: webserver
    restart: unless-stopped
    ports:
      - "80:80"
    volumes:
      - web-root:/var/www/html
      - ./nginx.conf:/etc/nginx/conf.d/nginx.conf
      - certbot-etc:/etc/letsencrypt
      - certbot-var:/var/lib/letsencrypt
    depends_on:
      - nodejs
      - db
    networks:
      - app-network

  certbot:
    image: certbot/certbot
    container_name: certbot
    volumes:
      - certbot-etc:/etc/letsencrypt
      - certbot-var:/var/lib/letsencrypt
      - web-root:/var/www/html
    depends_on:
      - webserver
    command: certonly --webroot --webroot-path=/var/www/html --email [email protected] --agree-tos --no-eff-email --staging -d bittap.io  -d www.bittap.io

volumes:
  certbot-etc:
  certbot-var:
  web-root:
    driver: local
    driver_opts:
      type: none
      device: /User/alan/test
      o: bind
  dbdata:
  node_modules:  

networks:
  app-network:
    driver: bridge

Source: StackOverflow