Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Powershell remote access to nanoserver on docker

I have created a W10 VM (guest) running docker, pulled microsoft/nanoserver image and hosted a container of the image.

(tutorial here: https://msdn.microsoft.com/en-us/virtualization/windowscontainers/quick_start/quick_start_windows_10)

Everything runs great, even host can ping the container running under guest W10. But what i cannot do, is to connect a remote powershell to container.

Enter-PSSession -ComputerName "<container ip>" -Credential ~\Administrator

This pops up a dialog asking for user and password. I cannot leave it blank or etc - the result is access denied. Any ideas how to connect or set a password for nanoserver container ?

like image 376
RassK Avatar asked Aug 28 '16 19:08

RassK


1 Answers

I've been struggling with this for a few days now. However, think my problem is slightly different though, as I'm trying to do an Enter-PSSession to a windows docker container, but from another machine, not the container host.

In this tutorial (http://dinventive.com/blog/2016/01/30/windows-server-core-hello-container/), the guy makes a nested container PSSession inside a host PSSession.

He uses this command, which is only available in the latest versions of Powershell. (not in v3)

Enter-PSSession -ContainerId "<container ID>"

Get the ID by doing :

Get-Container | fl

You also have to check your Powershell version and make an upgrade if needed.

To check PS version :

$PSVersionTable

And to download Powershell latest version : https://www.microsoft.com/en-us/download/details.aspx?id=50395

like image 199
G. Gomes Avatar answered Nov 18 '22 13:11

G. Gomes