I have encountered the same issue with Docker for Mac. I believe this is due to only certain paths being accessible for mounting (like the user directory), so instead docker searches for the path inside of the container VM and when it’s not found creates a blank directory at the path and attempts to mount that instead.
Related report over on the Mac forum: Unable to mount directories/files from `docker-compose` (oci runtime error … not a directory)