Thanks for your help. I think this was PEBKAC on my part. Perhaps @mrm can confirm for me. I changed my command to docker exec -u node and things seem better. Once my sync finishes I’m going to restart my docker but so far it seems that the permissions errors are gone. This forum post helped. I think when I was running that script it was changing the ownership of my database to root. It was also warning me of this my I very intelligently ignored that warning.
Edit: my sync finished and I was able to run docker exec -u node PhotoStructure ./photostructure sync with no further permission errors.