Is there a default user/password that the base microsoft/windowsservercore image uses?
Asked
Active
Viewed 9,019 times
7
-
have you tried "Administrator" with no password? according to [this piece of code](https://github.com/Microsoft/Virtualization-Documentation/blob/master/windows-container-samples/windowsservercore/MineCraft/MinecraftHost.ps1#L3), looks like you may have to create one via a ps1 script? – ddavison Oct 05 '16 at 14:33
-
If you just want to connect to the container, use `docker exec -it
powershell` and you'll have a PS prompt without having to log in. – Elton Stoneman Oct 05 '16 at 14:40 -
Im not trying to login, just trying to see if there is a default. Tried Admin/nopassword doesnt seem to work as you cannot create a pscredential with emtry string – maxfridbe Oct 05 '16 at 15:30
-
Trying Administrator and empty creds when creating service: The account name is invalid or does not exist, or the password is invalid for the account name specified New-Service : Service 'COMPANY Service (COMPANY Service)' cannot be created due to the following error: The account name is invalid or does not exist, or the password is invalid for the account name specified – maxfridbe Oct 05 '16 at 16:11
-
1Managed to get username... [Environment]::Username ContainerAdministrator empty password gave same error... – maxfridbe Oct 05 '16 at 16:18
-
Wondering same. Am trying to start a background process in new ps session. Maybe I need to throw down a new user and then start as that user? – Epu Dec 22 '16 at 16:05
-
It looks like documentation is still not clear, but if you drill down into the issues, it says ContainerAdministrator is not actually a user, but a special service account. AD domain users aren't loaded, so you're limited to locally created accounts? You can use the service account to make new users, but I haven't verified yet if you can run standard things as those users in a detached session. I'll investigate. See github issues https://github.com/docker/docker/issues/28585 and https://github.com/docker/docker/issues/28027 – Epu Dec 22 '16 at 16:16
2 Answers
8
I faced the same problem when i used microsoft/iis image. You are able to connect trough IIS Manager, but you are forced to enter a password because "empty" is not valid. so what i did with both docker images was the following: i added an admin user
RUN NET USER testing "Password01!" /ADD
RUN NET LOCALGROUP "Administrators" "testing" /ADD
hope that helps you, using this method for many docker images
2
You can login into running container with Enter-PSSession with -RunAsAdministrator
command and then create user and add to administrator's group via get-command -module Microsoft.Powershell.localaccounts
I put it in start up script of container and read those off values passed as environment variables which are used to start a container. This way you don't need to hardcode those values into image.

Gregory Suvalian
- 3,566
- 7
- 37
- 66