WSL2 on Windows Server running Linux containers

This topic has showed up on multiple instances, so I wanted to let everyone know that you CAN run Linux containers on Windows Server 2022 via WSL2. The blog post describing how to do that is available here: Using WSL 2 on Windows Server 2022 to run Linux containers - Microsoft Tech Community

NOTE: Linux containers on Windows (both Windows Server as well as Windows 10/11) are supported for development and testing purposes.

5 Likes

My goal is to use Windows Server 2022 with WSL2 to compile Linux images as part of my CI/CD (the company doesn’t want to maintain Linux servers).

I assume it doesn’t work the same way as Docker Desktop does?
I can’t install Docker EE on the Windows Server and switch to use Linux images instead of Windows, and expect Docker EE to use WSL2 for it? I would have to explicitly get into Linux WSL (Ubuntu for example), install Linux Docker in it, and use that manually. Meaning, in my CI (Team City) I would have to manually execute commands to gain access to WSL2 docker, and execute manual commands there, as oppose to using the CI’s “Docker” build steps?

That is correct. WSL 2 is essentially a utility VM (to which you don’t have access, as WSL manages it for you) running Linux. Your description of how this would work is correct.

1 Like