Docker Desktop start 3 mstsc.exe processes

Hi,

Recently, I found whenever I start the Docker Desktop, 3 mstsc.exe processes are started and cannot be killed. These 3 processes disappear after I quit Docker Desktop.

I am not 100% sure it is Docker Desktop that started these 3 mstsc processes, but I do constantly observe the correlation.

Does anybody know if Docker Desktop would do this?

Thanks

  • Do you have running containers?
  • Do you use Linux containers or Windows containers?

I have the latest Docker Desktop on my Windows but I can’t find a any process with that name. I switched from Linux containers to Windows containers, but still nothing. Then I switched from the WSL backend to Hyper-V. I still can’t see mstsc. Tried to run some containers, but no such process.

If Docker Desktop is not starting these processes, my guess is that you have an other application which has Docker support and detects if the Desktop is running. mstsc is related to remote desktop

I hope it gives you some idea.

It is not caused by Docker. It is caused by WSLg. WSLg uses Remote Desktop Connections? · Discussion #687 · microsoft/wslg · GitHub

Funny though, those mstsc processes correlate with the Docker process.

Not so funny, when you know that Docker Desktop uses two WSL distributions :slight_smile:
I don’t understand why I didn’t see those processes, because I use WSL backend, but I probably missed something.

So although Docker might not be directly launching them, they are still caused by Docker. If you shut down Docker Desktop, those three mstsc processes go away. Restart Docker, and back they come.

While it might be WSLg directly launching the things, it’s only doing so because of something Docker Desktop is doing.

The thing that’s incredibly frustrating about this is that recently they’ve started stealing the keyboard focus. Every minute, the focus is taken away from the foreground app, and not returned. (I’ve written an accessibilty API monitoring program to discover the culprit, which is how I worked out it was these mstsc instances.)

If I shut down Docker Desktop, the focus stealing stops. So from my perspective “caused by Docker” is in effect an accurate description. Start Docker Desktop, and within a few hours I’ll get this focus stealing problem. Stop Docker Desktop, and the problem goes away.

Only WSL2 on Windows 11 is affected. update: WSL2 on Windows 10 supports WSLg since end of 2022 as well.

I would suggest to slightly modify your testing approach: with stopped Docker Desktop, open ANY WSL2 distro and check again. You will see the same outcome, even though Docker Desktop is not involved.

If you don’t like this behavior of WSL2, then disable gui applications for WSL2:

I have discovered that running the 22H2 update to Windows 11 does not seem to update all of WSL2. I went to https://aka.ms/wslstorepage which opens the Windows Store app on the “Windows Subsystem for Linux” app, and after ensuring I had the latest version of that installed, I found that all the focus problems being caused by these mstsc instances went away.

The name changed from mstsc.exe to mstrdc.exe.

It still starts one rdp client per WSL2 distribution. Docker Desktop starts two WSL distributions, so you still have two rdp client instances running, unless guiApplications=false is set in .wslconfig

I have the same problem with Windows [Version 10.0.19045.3803] and Docker under WSL2
I have remote desktop disabled in settings and in the registry, however whenever I start docker desktop - with or without any running containers I get the mstsc processes starting.

I have even renamed the mstsc.exe to _mstsc to prevent it from running and then explored docker’s fucntionality for a few days and find nothing brown.

I would really like to get to the bottom of this because this seems on the surface to be an exploit or an horrendous undocumented misuse of RDP services.

I have also tried this under a fresh install of the OS and docker. Same result.

Remote desktop is disabled for my company and whenever I start docker desktop I get a remote desktop usage popup which I cannot close. The containers work fine but I would like to prevent the popup from launching.

Just when I’d almost lost hope I find some answers that works for my use case (Cli applications).
The comments about this being caused by WLS are indeed valid and this set me off down a new track. I managed to disable the Remote Desktop by adding guiapplications=false under the [wsl2] header. in C:\Users\%username%\.wslconfig (note the dot at the start of the filename).

[wsl2]
guiapplications=false

According to the docs: https://learn.microsoft.com/en-us/windows/wsl/wsl-config

Boolean to turn on or off support for GUI applications (WSLg) in WSL. 
Only available for Windows 11.

I’m running Windows 10 22H2 10.0.19045.4046 and it worked so maybe the docs are outdated or I misunderstood them,

Please note, if you use GUI applications such as Ubuntu Desktop this might not be a good idea. I only use the terminal so it suited me.