Docker error while creating mount source path on macOS

This week I was trying to get this Docker-based development environment set up for a project, on macOS. However I was getting this error:

1ERROR: for XYZ  Cannot start service XYZ: error while creating mount source path '/Users/pablobm/Documents/foo/bar/baz': mkdir /Users/pablobm/Documents: file exists

After trying a few things, it turned out that the problem was with having the project files in $HOME/Documents. I moved them to a different location, and that did the trick.

It must be interfering with Catalina's security features or something. I find it odd that I don't get the usual "SoAndSo would like to access files in your Documents folder" dialog, but go figure.