Compose expose on wslc
Compose's expose has no equivalent in wslc 2.9.4.0. There is no flag to translate it into, so a faithful migration is impossible -- the workload has to be restructured, or the key dropped and its effect achieved another way. This page documents what we measured and the closest working alternative.
| Compose key | expose |
|---|---|
| Status on wslc 2.9.4.0 | Not supported |
| wslc mapping | none |
| Verified against | wslc 2.9.4.0, windows-2025 runner |
Measured caveat. No --expose on wslc run. Publish with ports: (-p), or use -P to publish everything the image exposes.
The Compose input
A minimal service that uses expose. Everything below is derived from this
snippet, so you can match it against the shape of your own file.
services:
api:
image: node:22-alpine
expose:
- "3000" There is nothing to translate
wslc 2.9.4.0 has no flag that carries expose, so the key cannot be
migrated faithfully. Dropping it silently changes how the workload runs. The
closest working alternative:
# expose: is documentation-only in Compose. Publish the port for real:
wslc run --name proj-api -p 3000:3000 node:22-alpine
# Or publish every port the image declares:
wslc run --name proj-api -P node:22-alpine How we know
We verified this by running the flag against wslc 2.9.4.0 on a Windows Server 2025 runner rather than reading documentation. Unknown flags fail loudly -- wslc answers Argument name was not recognized for the current command and exits non-zero -- so a silent misconfiguration is unlikely. The risk is the opposite one: assuming a Docker habit carries over, scripting it, and only discovering at run time that the container never had the property you asked for.
Claims on this site are re-checked by a scheduled workflow that runs the commands
again on a fresh Windows Server 2025 runner and fails when a documented behaviour
stops matching reality. wslc ships roughly every two weeks during the preview, so
treat any page that disagrees with your own machine as the page being stale, and
check the version you are on with wslc version.
Where this key sits in the wider picture
Of the 39 Compose keys we audited against wslc 2.9.4.0, 23 translate directly, 2 translate with a caveat, and 14 have no equivalent at all. That ratio is the honest answer to whether a Compose stack can move to wslc today: simple single-service definitions usually port cleanly, while anything relying on orchestration, capabilities or restart behaviour does not.
Microsoft is tracking native Compose support in issue 40948, opened by a WSL program manager. At the time of writing it carried no milestone, no assignee and no implementation pull request, and the strongest community proposal is to expose a Docker Engine API-compatible endpoint and bundle upstream Compose rather than reimplement it. Either route would change this page from a migration guide into a behaviour-difference reference, which is why the URL will not move.
Full mapping table: Docker Compose to wslc migration guide. Command-level equivalents: Docker to wslc cheat sheet. Paste a whole file into the Compose migration analyser to see every key in it classified at once.