简体   繁体   中英

runas or psexec inside Windows container

I have a windows image based on mcr.microsoft.com/windows:1809 .

In my Dockerfile, I created a new user via

net user /add myuser mypassword

Now I would like to enter the container, eg via docker run -it and execute commands via the myuser (instead of the standard user ContainerAdministrator ).

I tried both runas and psexec but both commands did not work as expected or gave various errors, among others these and these .

How can I run a command inside a Windows docker container as a different user other than ContainerAdministrator ?

Use the arg while running "docker run" command.参数。 In your case your user "myuser" will be the arg value as below

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