简体   繁体   中英

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 "do.net"?

Is this even possible?

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"

You can use WORKDIR "C:\foldername" in dockerfile

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM