Here is something mysterious: I am running a Drupal 9 installation on Windows WSL2 with Docker and DDEV, which works great. Now I have decided to set up a private files directory for images. I have done so, following all the instructions (e.g. private directory at the same level as the web directory). I did the same for a live server on cPanel. Then I created a simple test entity with only an image field, specifying that uploaded images were to go into the private directory.
The cPanel server version works exactly as expected -- when I created a new image entity, the image went right into the private directory. So I'm pretty sure I have the procedure down correctly.
But the DDEV version does mysterious things. When I create a new image entity, everything goes just fine, the entity is created, I can see the image, etc. But the private directory is empty. Furthermore, if I search the entire WSL2 file system, the image file is nowhere to be found. And yet it is there, somewhere. I have created several such entities, and now have a nice list of about ten image files, all of which display nicely. And all of which are nowhere to be found in the WSL2 file system (at least through a filename search), and certainly not in the specified private directory.
So where are they?? Any ideas about this mystery? :-)
Thanks!
P.S. There is only one clue I have noticed. The first time, I accidentally specified my private files directory to be below the web directory. Then it worked correctly, and I saw the uploaded image file. But as you know, the instructions are that it should NOT be inside the web directory, but rather outside of it, not HTTPS accessible. So maybe DDEV has some kind of unusual characteristic that makes it a problem to have the private directory outside of the web directory.
The question was answered by the comments of rfay to the original post.