简体   繁体   English

无法让 Windows Docker 容器“以管理员身份运行”

[英]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.我有一个 .NET Core 应用程序,需要“以管理员身份运行”,我正试图将其内置到 Docker 图像中。 I am able to build a Docker image just fine, but it fails at runtime with the "Need to run as Administrator" error.我能够很好地构建一个 Docker 图像,但它在运行时失败并出现“需要以管理员身份运行”错误。

Is there a way in the Dockerfile or in the docker run command to specify this?有没有办法在 Dockerfile 或 docker 运行命令中指定它? Does something else need to be added to the ENTRYPOINT where I'm calling "do.net"?是否需要在我调用“do.net”的 ENTRYPOINT 中添加其他内容?

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.我玩弄了 Dockerfile 中的 USER 命令,但无法让它与管理员用户一起使用。

However, I found in a GitHub posting the mention of specifying the user in the docker run command like this did:但是,我在 GitHub 中发现提到在 docker 运行命令中指定用户,如下所示:

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

Which also works in the Dockerfile like so:这也适用于 Dockerfile ,如下所示:

USER "NT Authority\System"

You can use WORKDIR "C:\foldername" in dockerfile您可以在 dockerfile 中使用 WORKDIR "C:\foldername"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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