Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't get a Windows Docker container to "run as administrator"

I have a .NET Core app that's required to be "run as administrator" and I'm trying to get it to be built into a Docker image. I am able to build a Docker image just fine, but it fails at runtime with the "Need to run as Administrator" error.

Is there a way in the Dockerfile or in the docker run command to specify this? Does something else need to be added to the ENTRYPOINT where I'm calling "dotnet"?

Is this even possible?

like image 280
jtalarico Avatar asked Oct 26 '25 02:10

jtalarico


1 Answers

I played around with the USER command in the Dockerfile, but could never get it to work with an admin user.

However, I found in a GitHub posting the mention of specifying the user in the docker run command like this did:

 docker run --user "NT Authority\System" ...

Which also works in the Dockerfile like so:

USER "NT Authority\System"
like image 161
jtalarico Avatar answered Oct 28 '25 19:10

jtalarico