Docker container - users other than containeradministrator in TP5? RRS feed

  • Question

  • Using Server 2016 Standard TP5 with docker image windowsservercore 10.0.14300.1000, and it doesn't seem to be possible to get the whoami command to return anything other than "user manager\containeradministrator". Tried -u on both docker run and exec to try and switch the user, without any obvious effect.

    The runas command itself doesn't seem to be producing any output, either, although it does appear to validate usernames and passwords. After enabling the Administrator account, the runas command shows the following:

    C:\tmp>runas /user:Administrator whoami Enter the password for Administrator: Attempting to start whoami as user "F5B982F9C32E\Administrator" ...

    with no output from the command at all.

    Is switching users inside docker containers expected to work in TP5? Have I missed something obvious?

    • Edited by tdolby Monday, July 4, 2016 12:00 PM
    Monday, July 4, 2016 9:10 AM

All replies

  •  I am also seeing this problem. I'm unable to run as administrator, which is causing issues for some software that i'm trying to install.

    Thursday, July 21, 2016 11:07 PM
  • I am using TP5.  Have you tried running "whoami" in the container?  For me it returns:

    user manager\containeradministrator

    What are you doing that is failing?



    Frank Postle

    Friday, July 22, 2016 12:58 AM
  • I thought about this more.  if you want a new account you could create one.  Adding this in your Dockerfile:

    RUN "net user /add newadmin Pa$$w0rd"
    RUN "net localgroup administrators newadmin /add"

    This will create a new local administrator account with a known password.  I didn't test it on nano, but I did test it on windowsservercore


    Frank Postle

    Friday, July 22, 2016 3:20 AM
  • I get the same results as you do with whoami, regardless of which user I give to docker (with run or exec). I have tried creating users inside the container, and tried your user-creation suggestion in the Dockerfile, but it didn't seem to change anything: whoami always responds with containeradministrator, and runas never seems to run anything.

    It looks like the user switching code isn't working, as I tried putting a "USER newadmin" line in my Dockerfile only to have the docker build command respond with

    The daemon on this platform does not support the command 'user'

    which seems to indicate it can't be done :(

    Friday, July 22, 2016 2:52 PM
  • Hello,

    Our team is looking into this. I will get back to you when I hear more.


    Friday, August 5, 2016 10:52 PM
  • Hi.  Any update, please?  As stated, whoami returns: 'user manager\containeradministrator'.  How do we use\enable\expose a local account?  Or, how do we set the conataineradminstrator account password?  Help is appreciated.  Thanks.
    Wednesday, August 31, 2016 8:23 PM
  • Hello,

    Our team is looking into this. I will get back to you when I hear more.


    Hi Ender,

    Is there any progress on this? Can we change the user running CMD?



    Thursday, October 27, 2016 1:10 PM
  • Hi,

    I am facing the same problem. Can we change the password of containerAdministrator?


    Monday, April 17, 2017 12:17 PM
  • Echoing the same questions above.   I'm running a "microsoft/windowsservercore" Docker container on Windows 2016 and I'm trying to run some commands inside the container as another local user.  The "runas..." approach is not behaving as expected for me.

    Wednesday, June 7, 2017 12:20 AM
  • Any more news on this?
    Wednesday, April 4, 2018 10:59 AM
  • I am having exactly the same issue outside and inside of the container, did you find any solution?

    PS D:\docker\dockerfiles> docker exec -it 94cd02a666b7 runas /user:oracledbuser cmd
    Enter the password for oracledbuser:
    Attempting to start cmd as user "94CD02A666B7\oracledbuser" ...
    PS D:\docker\dockerfiles>

    Wednesday, December 5, 2018 2:44 PM
  • @juanma1973

    You may consider to use the official container image from Oracle.

    Sic Parvis Magna

    Thursday, December 20, 2018 1:56 AM