Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Logging into running container
Ways to Login to Container
There are 2 primary ways to interactively login to container
docker exec -it <containterID> powershellcommand like below. You don't need exact just a couple of letters from ID is enough. You can get ID of running container from "Get-Container" cmdlet.
PS C:\Users\admin> get-container ID Image Command Created Status Names -- ----- ------- ------- ------ ----- 41d3933032a1183e0... microsoft/iis C:\ServiceMonitor... 1/19/2017 2:41:07 PM Up 55 seconds hungry_banach
PS C:\Users\admin> docker exec -it 41d powershell Windows PowerShell Copyright (C) 2016 Microsoft Corporation. All rights reserved. PS C:\> whoami user manager\containeradministrator
- Login using
Enter-PSSessioncmdlet in following form
Enter-PSSession -ContainerID <containerID> -RunAsAdministrator. To get you can use following shortcut if you know automatically assigned name (like
hungry_banachabove. You can see prompt changes to containerID once logged in.
PS C:\Users\admin> Enter-PSSession -ContainerId (Get-Container hungry_banach).ID -RunAsAdministrator [41d3933032a1...]: PS C:\Users\ContainerAdministrator\Documents> whoami user manager\containeradministrator [41d3933032a1...]: PS C:\Users\ContainerAdministrator\Documents>
You can explore around the container to see what is there and what is missing
- Container name which seems to be first 14 characters of containerID
[41d3933032a1...]: PS C:\> $env:ComputerName 41D3933032A1
- Check who is member of administrators group. It is unsurprisingly Administrator account which is DISABLED. That means that you can NOT login to this computer remotely with ANY remote administrations tools. More on workarounds on this later.
[41d3933032a1...]: PS C:\> get-localgroupmember Administrators ObjectClass Name PrincipalSource ----------- ---- --------------- User 41D3933032A1\Administrator Local [41d3933032a1...]: PS C:\> get-localuser Administrator Name Enabled Description ---- ------- ----------- Administrator False Built-in account for administering the computer/domain
- Please note that
Serverservice is not running and in fact it's impossible to start. This in addition of lack of username/password will prevent you from accessing file system in container or use remote administration tools
[41d3933032a1...]: PS C:\> get-service Server Status Name DisplayName ------ ---- ----------- Stopped LanmanServer Server
- Check ip configuration of container. You can see it's behind docker nat and points to internal NAT gateway. IP address is manually assigned to container (not DHCP by docker) along with other optional parameters which you can modify (like DNS)
[41d3933032a1...]: PS C:\> ipconfig Windows IP Configuration Ethernet adapter Ethernet 2: Connection-specific DNS Suffix . : domain.com Link-local IPv6 Address . . . . . : fe80::ec1d:a23a:42d9:2fc5%5 IPv4 Address. . . . . . . . . . . : 172.22.217.102 Subnet Mask . . . . . . . . . . . : 255.255.240.0 Default Gateway . . . . . . . . . : 172.22.208.1
Clone this wiki locally
Press h to open a hovercard with more details.