Earlier quoted context omitted.
In a container or not, running a compiler-as-a-service as root is never the right way to run a compiler-as-a-service.
Why not? There's a good chance the user will be needing to install extra packages or libraries, or run custom makefile steps that require extra permissions the system designer couldn't anticipate. Running as root I think is the exact thing to run as. Then throw the whole VM or container away when handling a request for another user.
Re: #include </etc/shadow>
#131Running a compiler as root in general is not recommended. It's the principle of least privilege. Running without unnecessary privileges is a good idea for the same reason running in a sandbox is a good idea.