【发布时间】:2017-05-20 07:11:35
【问题描述】:
我正在尝试对 windows docker 容器执行 Enter-PSSession,但来自另一台机器,而不是容器主机。
在本教程 (http://dinventive.com/blog/2016/01/30/windows-server-core-hello-container/) 中,这个家伙在主机 PSSession 中创建了一个嵌套容器 PSSession。
他说:“正如你所见,我们在两个 PSSession 中,一个在 Nanohost 上,另一个在 iambasicone 容器中。我认为这很酷而且很棒。” 为此,他使用:
Enter-PSSession -ContainerName ‘iambasicone’ -RunAsAdministrator
就我而言,我想直接从远程机器连接到容器。我不能使用相同的表达式,因为远程机器没有启用容器功能。
Enter-PSSession : The Containers feature may not be enabled on this machine.
At line:1 char:1
+ Enter-PSSession -ContainerName 10.254.34.70
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Enter-PSSession], PSInvalidOperationException
+ FullyQualifiedErrorId : CreateRemoteRunspaceForContainerFailed,Microsoft.PowerShell.Commands.EnterPSSessionCommand
所以,我必须使用 -ComputerName 选项。但是随后需要凭据,即使我提供了凭据,也会显示拒绝访问。
如果我想要实现的目标是可能的,有什么想法吗?或者容器在这种情况下的行为不像虚拟机? (因为我尝试用虚拟机做同样的事情,而且效果很好......)
【问题讨论】:
标签: windows powershell docker containers remote-access