I don’t know if you still need a solution to your question.
So in docker containers, the username and group name are not important, but the uid and gid are.
In your case, you want all the files written by your app belong to a user on the host machine. To do this, you will need the user’s uid. Say you’re running Shinyproxy on a linux host, then you can get a user’s uid by typing
id username on your host machine. The output will be like
uid=10xxx(foo) gid=1xxx(bar) groups=xxxxxxx. What you want it the value of uid. Once you get that, in your app code, after all the work is done, run something like
system(paste("chown -R", uid, resultDir)). This will change the owner of the directory and all the files in it to the user corresponding to the specified uid. If it’s just one file, just turn the -R switch off.
But I don’t think this is a very good solution since using ‘root’ can be very dangerous. I’m also hoping that the docker container run --user option can be set directly from shinyproxy config. As @fmichielssen suggested, you can set the USER in Dockerfile to achieve this.