Docker Community Forums

Share and learn in the Docker community.

How can I run a program inside windows container using a local account, not-ContainerAdministrator

docker

(Longshin) #1

Hi,

I am trying to install a program on my docker image based on windowsservercore.
This application should be installed under a local account which I have created giving it the instruction in docker file:

FROM microsoft/windowsservercore
RUN "net user /add custom-admin Control01"
RUN “net localgroup Administrators custom-admin /add”

Once a container is launched, I start a new cmd session to run a *.bat, but the issue is that it should be installed by custom-admin local account instead of user manager/ContainerAdministrator

c:\>runas /user:custom-admin SilentInstall_Server.bat
Enter the password for custom-admin:
Attempting to start SilentInstall_Server.bat as user “0E81A78A0926\custom-admin” …

c:\>whoami
user manager\containeradministrator

c:\>


(Boiky) #2

FROM microsoft/windowsservercore
RUN net user /add custom-admin
RUN net localgroup Administrators custom-admin /add
USER custom-admin
RUN SilentInstall_Server.bat