有没有办法通过远程桌面连接到运行中的Windows Server容器? [英] Is there a way to connect through remote desktop to a running Windows Server container?

查看:699
本文介绍了有没有办法通过远程桌面连接到运行中的Windows Server容器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在docker Windows服务器容器中运行旧的.NET应用程序( https://hub.docker.com/r/microsoft/windowsservercore/).

I want to run an old .NET application in a docker windows server container (https://hub.docker.com/r/microsoft/windowsservercore/).

如果此应用程序不需要UI,一切都会变得很容易.它的UI会执行很多操作,而这些操作无法通过命令行或其他API来完成.

Everything would be easy if this application didn't require an UI. Its UI does a lot of stuff and this stuff cannot be done through command line or other API.

基本上,完美的方法是通过RDP到达此正在运行的容器.

Basically, the perfect thing would be to reach this running container through RDP.

据我了解,它不过是在某个TCP端口(默认端口3389)上运行的服务(TermService).

From my understanding, it is nothing more than a service (TermService) running on a certain TCP port (3389 being the default one).

但是看来TermService不在Microsoft/windowsservercore容器中运行.

But it seems that TermService is not running in microsoft/windowsservercore containers.

我找到了一篇文章介绍如何激活它: https://withinrafael.com/2018/03/09/using-remote-desktop-services-in-containers/

I found an article showing how to activate it : https://withinrafael.com/2018/03/09/using-remote-desktop-services-in-containers/

基本上,我保留了相同的Dockerfile,只是更改了一些凭据.

Basically, I kept the same Dockerfile, just changing some credentials.

#escape=`
FROM microsoft/windowsservercore:1709_KB4074588
RUN net user /add jerome
RUN net user jerome aDifficultPassword
RUN net localgroup "Remote Desktop Users" jerome /add
RUN net localgroup "Administrators" jerome /add
RUN cmd /k reg add "HKLM\System\CurrentControlSet\Control\Terminal Server" /v TemporaryALiC /t REG_DWORD /d 1

我使用以下命令启动容器:

I launch the container with this command :

docker run -it -p3389:3389 myimage powershell

当我连接到容器并键入一些powershell命令以列出正在运行的服务时,我可以看到TermService运行良好.这是我用来列出服务的命令.

When I connect to the container and type some powershell commands to list running services, I can see that TermService is well running. This is the command I use to list services.

Get-Service

当我列出打开的TCP端口时,可以看到监听了3389.这是我用来显示打开的端口的命令.

When I list opened TCP ports, I can see that 3389 is listened. This is the command I use to show opened ports.

netstat -an

当我尝试通过远程桌面客户端连接到容器时,开始时一切正常.

When I try to connect to the container through my remote desktop client, things seems OK at start.

  • 它要求我提供主机.
  • 然后输入用户名和密码.
  • 如果我输入了错误的凭据,则说凭据错误",因此与服务器之间的通信很好.
  • 如果我输入良好的凭据,则什么也不会发生.完全没有错误消息,但是也没有显示屏...

我真的不知道日志是否在某处生成.

I don't really know if logs are generated somewhere or not.

如果像TigerVNC这样的工具代替RDS,我会好的.我以前从未尝试过使用此工具,但似乎可以完成这项工作.

I would be OK if instead of RDS, something like TigerVNC was working. I have never tried this tool before but it seems that it could do the job.

您将如何控制在Windows容器中运行的GUI应用程序?

How would you do to control a GUI application running in a windows container?

推荐答案

您可以在事件查看器中找到RDP客户端的日志:应用程序和服务日志" \ Microsoft \ Windows \ TerminalServices-ClientActiveXCore.这就是我的意思:

You can find logs for RDP client in event viewer : "Application and Services Logs"\Microsoft\Windows\TerminalServices-ClientActiveXCore. Here's what is says for me :

  1. 客户端已建立与服务器的多传输连接.
  2. RDPClient_SSL:响应TsSslEventInvalidState从TsSslStateDisconnected过渡到TsSslStateDisconnected时遇到错误(错误代码0x8000FFFF).

  1. The client has established a multi-transport connection to the server.
  2. RDPClient_SSL: An error was encountered when transitioning from TsSslStateDisconnected to TsSslStateDisconnected in response to TsSslEventInvalidState (error code 0x8000FFFF).

RDP ClientActiveX已断开连接(原因= 2)

RDP ClientActiveX has been disconnected (Reason= 2)

原因2被客户端关闭了会话.

reason 2 is session closed by client.

我的偏执狂告诉我,微软回过头去修补了该映像,以防止人们将RDP与docker一起使用,但是谁知道呢,也许我们只是缺少一些明显的东西.

My paranoia tells me that microsoft went back and patched the image to prevent people from using RDP with docker, but who knows, maybe we're just missing something obvious.

这篇关于有没有办法通过远程桌面连接到运行中的Windows Server容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆