Docker Compose,WSL 容器的缺失环节

Docker Compose, chaînon manquant des conteneurs WSL

Silicon.fr Quality unknown · 质量未知 by Clément Bohic 2026-10-01 08:50 Original
摘要
微软确认WSLc容器已进入通用可用阶段,并表示将把Docker Compose等能力作为优先事项推进:在WSLc项目内部尚未最终决定是完全重实现Docker Compose,还是直接暴露Docker API(倾向后者),通过受过滤的访问点来绕过安全控制;测试显示Docker Compose、Dev Containers和Testcontainers可正常工作,但仍缺少多架构支持(无QEMU/binfmt)。同时,微软还与Defender/EDR和Intune打通:EDR可关联WSLc内活动与主机,Intune可启停容器并限制拉取到批准镜像仓库;在技术架构上,WSLc采用用户态网络转发以缓解VPN/防火墙问题,并提供持久化存储(默认临时写入、支持virtiofs映射卷及VHD卷以实现严格配额与ext4兼容)。

微软已将 WSL 容器的“正式可用”提上日程,但在当前版本里,Docker Compose 仍然不是原生能力。微软表示这项功能是优先事项,不过在 WSL 项目内部,技术路线尚未最终敲定:到底是完整重做 Docker Compose,还是直接向外暴露 Docker API。

从现有进展看,后者似乎更可能成为最终方案,因为 Docker 引擎本身已经在系统中可用。每个 WSLc 会话实际上都会运行一套标准、完整的 Moby(dockerd)实例,只是访问它的 Unix socket 目前没有连接到任何外部入口。理论上,只要把一个监听端口暴露给 Windows 主机即可使用。

但直接开放原始 socket 会绕过 WSLc 的安全控制,因此微软更倾向于部署一个经过过滤的访问点,对敏感请求进行拦截和校验。测试结果显示,这一路径是可行的:Docker Compose、Dev Containers 和 Testcontainers 都能完整运行。不过,结构性限制依然存在,最明显的是不支持多架构:由于缺少 QEMU/binfmt,外来架构二进制会直接失败。

围绕生态兼容性,微软并未提及社区项目 wslc-compose——它通过 Python 包提供临时替代方案;但提到了 WSL Container Desktop 和 Lazywslc,这两者则针对 WSLc 目前另一项短板:缺少用于管理容器的图形界面。

在企业管理方面,微软还为其 EDR 建立了桥接能力,可以提取 WSLc 环境中的活动并与宿主机行为关联分析。与此同时,Intune 也获得了对 WSLc 容器的控制能力,可用于启用或禁用容器,并限制镜像拉取来源只能来自受信任的 registry。

网络架构上,WSLc 与 Docker Desktop 的思路明显不同。Docker Desktop 运行在共享的 WSL 虚拟机中,而 WSLc 则是“每个容器一个虚拟机”。它不接入传统的 Hyper-V 虚拟交换机,而是把数据包以原始 Ethernet 帧的形式送入一个虚拟化队列,再由 Windows 端的专用用户态进程持续读取该队列,并将请求重新发往 Windows 网络栈。这样做的好处是,避免了传统 WSL2 模式下 NAT、每个 VM 独立 IP 带来的 VPN 和防火墙兼容问题。

存储方面,每个会话都有自己的虚拟硬盘,用来保存整个环境的全局状态,并直接存放在 Windows 主机上。默认情况下,容器的写入层是临时性的;若要持久化数据,则需要使用 volume。volume 会映射到宿主机上的某个目录,并通过 virtiofs 暴露给虚拟机。另一种选择是 VHD volume:其后端不是共享的 Windows 目录,而是专用虚拟磁盘文件。相比普通共享目录,这种方式可以强制设置严格的容量上限;同时,采用 ext4 格式也能减少某些对 NTFS 特性兼容性较差的软件带来的问题。

Summary
Microsoft has confirmed general availability for WSL containers (WSLc) and says Docker Compose support is a priority, but it has not yet decided whether to fully reimplement Compose or expose the Docker API directly. The proposed approach is to expose a filtered Docker API endpoint by leveraging the already-running Moby/dockerd inside each WSLc session, with tests showing Docker Compose, Dev Containers, and Testcontainers work—though multi-architecture support is still missing due to lack of QEMU/binfmt. Microsoft also announced integrations with Defender/EDR and Intune for container visibility and policy control, plus a user-space networking design to improve VPN/firewall compatibility and options for persistent storage via virtiofs-mapped volumes or VHD-backed volumes.

Microsoft has confirmed general availability for WSL containers, but Docker Compose is still missing from the stack. The company says it is making Compose a priority, yet within the WSL project the choice has not been settled between fully reimplementing Docker Compose or exposing the Docker API directly.

The direction now appears to favor direct API exposure, since the Docker engine is already present and working. Each WSLc session actually runs a standard, full Moby daemon (dockerd); the Unix socket used to reach it is simply not connected to any external entry point. In theory, Microsoft could just expose a listener to the Windows host. But a raw socket would bypass WSLc’s security controls, so the preferred approach is to deploy a filtered access point that intercepts and validates sensitive requests. Tests have been successful: Docker Compose, Dev Containers and Testcontainers all work fully. Some structural limits remain, however, including the lack of multi-architecture support, since the absence of QEMU/binfmt causes foreign binaries to fail.

Microsoft does not mention the community project wslc-compose, which provides a workaround through a Python package. It does cite other tools, including WSL Container Desktop and Lazywslc, both of which address another current WSLc limitation: the lack of a graphical interface for container management.

In the meantime, Microsoft has built a bridge with its EDR, which can extract activity from the WSLc environment and correlate it with host activity. An integration with Intune is also in place, allowing containers to be enabled or disabled and pulls to be restricted to approved registries.

On the networking side, WSLc uses a user-space architecture rather than the shared WSL VM model used by Docker Desktop. Instead of attaching VMs to a standard Hyper-V virtual switch, it creates one VM per container and sends packets as raw Ethernet frames through a virtual queue. A dedicated Windows user-space process continuously reads that queue and re-emits the requests onto the Windows network. This avoids the problems of the traditional WSL2 model — NAT and a separate IP per VM — which can interfere with VPNs and firewalls.

For persistence, each session has its own virtual hard disk storing the overall state of the environment directly on the Windows host. By default, a container’s writable layer is ephemeral, but volumes can preserve data. These are mapped to a host folder exposed to the VM via virtiofs. Microsoft also supports VHD volumes, where the source is not a shared Windows directory but a dedicated virtual disk file. Compared with shared folders, this enforces a strict storage limit, and formatting the volume as ext4 avoids issues with software that handles NTFS quirks poorly.

Résumé
Microsoft confirme la disponibilité générale des conteneurs WSL, mais indique que l’intégration de Docker Compose n’est pas encore tranchée : l’orientation semble plutôt vers l’exposition directe de l’API Docker via un point d’accès filtré, plutôt que la réimplémentation complète. Les tests montrent que Docker Compose, Dev Containers et Testcontainers fonctionnent, avec toutefois des limites structurelles (notamment l’absence de multiarchitecture faute de QEMU/binfmt). Côté sécurité et gestion, Microsoft relie WSLc à Defender et Intune, et décrit une architecture réseau en espace utilisateur pour mieux gérer VPN/pare-feu, ainsi que des options de stockage persistant via volumes (virtiofs) ou VHD.

Disponibilité générale actée pour les conteneurs WSL… mais n’y cherchez pas de fonctionnalité à la Docker Compose.

Microsoft affirme en faire une priorité. Cependant, au sein du projet WSL, on n’a pas encore tranché entre réimplémenter complètement Docker Compose ou exposer directement l’API Docker.

Vers une exposition directe de l’API Docker

On semble se diriger vers la deuxième solution, étant donné que le moteur Docker est déjà présent et fonctionnel. Chaque session WSLc exécute effectivement une version standard et complète de Moby (dockerd). Le socket Unix par lequel on y accède n’est simplement relié à aucun point d’accès externe. Il suffirait donc théoriquement d’exposer un écouteur vers l’hôte Windows.

Un socket brut contournerait toutefois les contrôles de sécurité de WSLC. L’option préconisée consiste ainsi à déployer un point d’accès filtré interceptant et validant les requêtes sensibles. Les tests ont été concluants : Docker Compose, Dev Containers et Testcontainers fonctionnent complètement. Des limites structurelles demeurent néanmoins. Entre autres, il n’y a pas de prise en charge du multiarchitecture (l’absence de QEMU / binfmt fait planter les binaires étrangers).

Des passerelles avec Intune et Defender

Microsoft n’évoque pas le projet communautaire wslc-compose, qui offre un palliatif sous la forme d’un package Python. Il mentionne en revanche d’autres, dont WSL Container Desktop et Lazywslc. Tous deux résolvent une autre limite actuelle de WSLc : l’absence d’une interface graphique de gestion des conteneurs.

En attendant ces ajouts, Microsoft a créé une passerelle avec son EDR, qui peut extraire l’activité de l’environnement WSLc et la corréler à celle de l’hôte. Une jonction est également établie avec Intune, qui peut activer et désactiver des conteneurs, ainsi que restreindre les tirages à des registres approuvés.

Une architecture réseau en espace utilisateur

Alors que Docker Desktop tourne dans la VM WSL partagée, WSLc crée une VM par conteneur. Il ne les attache pas à un commutateur virtuel Hyper-V classique : elles envoient leurs paquets sous forme de trames Ethernet brutes via une file d’attente virtualisée. Un processus Windows dédié en espace utilisateur lit cette file en continu et réémet les requêtes sur le réseau Windows. Cela évite les problèmes que le modèle WSL2 traditionnel – NAT, avec une IP distincte par VM – pose avec les VPN et les pare-feu.

Plusieurs options pour le stockage persistant

Chaque session dispose de son propre disque dur virtuel qui stocke l’état global de l’environnement. Il est stocké directement sur l’hôte Windows.

Par défaut, l’espace d’écriture d’un conteneur est éphémère. Des volumes permettent de conserver les données. Ils sont mappés à un dossier sur l’hôte, exposé à la VM via virtiofs. Il en existe une variante : les volumes VHD, où la source n’est pas un dossier Windows partagé mais un fichier disque virtuel dédié. Par rapport aux dossiers Windows partagés, cela permet d’imposer une limite de stockage stricte. Et le formatage en ext4 évite les problèmes avec les logiciels qui gèrent mal les particularités de NTFS.

Illustration générée par IA

The post Docker Compose, chaînon manquant des conteneurs WSL appeared first on Silicon.fr.

AI Insight
Core Point

Microsoft has shipped general availability for WSL containers but is still deciding how to deliver Docker Compose—likely by exposing the Docker API via a filtered access layer—enabling Compose/Dev Containers/Testcontainers while leaving gaps like multi-architecture.

Key Players

Microsoft — develops WSL/WSLc, container runtime integration, and enterprise controls via Defender/Intune; Redmond, US.

WSLc (WSL containers project / WSLc) — runs per-container VMs with Moby/dockerd and provides the container execution substrate; Microsoft ecosystem.

wslc-compose (community) — Python package workaround to add Compose-like functionality; community.

WSL Container Desktop / Lazywslc — tools adding container management UI and related usability on WSLc; community.

Industry Impact
  • Computing/AI: Medium — smoother local container workflows on Windows improves dev/test pipelines used by AI teams.
  • ICT: High — enterprise-grade container governance via Defender/Intune plus Compose support reduces friction for Windows-based container adoption.
  • Energy: Low — no direct relevance.
Tracking

Monitor — Compose enablement and Docker API exposure in WSLc will materially affect Windows container developer experience and enterprise security integration.

Related Companies
neutral
positive
neutral
neutral
positive
neutral
positive
Categories
软件 云计算 网络安全
AI Processing
2026-10-01 09:00
openai / gpt-5.4-nano