Docker Compose for Windows' new WSL containers (wslc.exe), written in Rust.
Website: https://ricardoborges.github.io/rcompose/
Microsoft's WSL container preview lets you run Linux containers on Windows without Docker Desktop or a Podman machine. What it doesn't have is Compose. I wanted to keep using my existing compose.yaml files, so I wrote rcompose: you run rcompose up in a folder and it drives wslc for you.
A few things it does that you might care about:
- Services that don't depend on each other start in parallel;
depends_on(includingservice_healthy) is still respected. rcompose uponly recreates containers whose configuration actually changed. It stores a hash of each service's config in a container label, the same way Docker Compose does.- The WSL preview sometimes fails with transient errors like
ERROR_SHARING_VIOLATIONwhen several containers start at once.rcomposeretries those instead of giving up. rcompose logs -finterleaves every service's output with a color per service, andCtrl+Cshuts things down cleanly.
You need Windows 11 with the WSL container preview (wslc.exe) installed.
The easiest way is the install script:
irm https://ricardoborges.github.io/rcompose/install.ps1 | iexIt grabs the latest release for your machine (x64 or ARM64), puts rcompose.exe in %LOCALAPPDATA%\Programs\rcompose and adds that folder to your user PATH. No admin rights needed. Run it again whenever you want to update. If you want a specific version or a different folder, set RCOMPOSE_VERSION (e.g. v0.1.0) or RCOMPOSE_INSTALL_DIR first.
If you'd rather build it yourself, you'll need Rust 1.92 or newer:
git clone https://github.com/ricardoborges/rcompose.git
cd rcompose
cargo install --path crates/rcompose-cliThat installs into %USERPROFILE%\.cargo\bin, which rustup already puts on your PATH. (If you use a custom CARGO_HOME that isn't on PATH, add --root "$env:USERPROFILE\.cargo".)
One thing to avoid: don't drop rcompose.exe into C:\Program Files\WSL. That folder belongs to the WSL installer, which can remove files it doesn't recognize when it updates or repairs itself. rcompose doesn't need to live next to wslc.exe; it looks for it in WSLC_BIN, then on PATH, then at C:\Program Files\WSL\wslc.exe.
rcompose relies on WSL Containers (wslc.exe), which requires the Windows Host Compute Service (vmcompute) and Host Network Service (HNS) to be active. No Linux distribution or Docker Desktop installation is required.
Ensure the required Windows optional features are enabled (run PowerShell as Administrator):
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform -All -NoRestart
Enable-WindowsOptionalFeature -Online -FeatureName Containers -All -NoRestart
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux -All
## Using it
If you've used `docker compose`, you already know how this works. From a folder with a `compose.yaml` or `docker-compose.yml`:
```powershell
rcompose up -d # start everything in the background
rcompose ps # see what's running
rcompose logs -f # follow the logs
rcompose exec web sh # open a shell in the "web" service
rcompose down -v # stop and clean up, including named volumesTo see the final config after variables and .env are applied, run rcompose config (add --format json if you prefer JSON).
Global options: -f <file>, -p <project>, --env-file <file>, --profile <name> (repeatable).
| Command | What it does |
|---|---|
rcompose up [-d] [--build | --no-build] [--force-recreate] [--remove-orphans] [-t <secs>] [services] |
Build or pull missing images and start services, waiting on depends_on conditions |
rcompose down [-v] [--remove-orphans] [-t <secs>] |
Stop and remove containers and networks (and named volumes with -v) |
rcompose ps [-a] [-q] [services] |
Container status, health and ports |
rcompose logs [-f] [-t] [-n <tail>] [services] |
Logs from all services, color-coded |
rcompose exec [-T] [-d] [-u <user>] [-w <dir>] [-e K=V] [--index N] <service> <cmd...> |
Run a command in a running container |
rcompose start / stop / restart [-t <secs>] [services] |
Start, stop or restart services |
rcompose build [--no-cache] [--pull] [services] |
Build images from build: sections |
rcompose pull [services] |
Pull service images |
rcompose config [--format json|yaml] [--services] [-q] |
Validate and print the resolved project |
rcompose version |
Print the version |
Most everyday Compose files should just work. Supported:
- Variable interpolation (
${VAR},${VAR:-default},${VAR:?error},${VAR:+alt}, nesting,$$) from your environment and.env - YAML anchors and merge keys (
<<: *base),x-*extension fields - Short and long syntax for
ports,volumes,env_file(includingrequired: false) anddepends_on depends_onconditions:service_started,service_healthy,service_completed_successfullyhealthcheck, multiplenetworkswithaliases,externalnetworks and volumes,profilesbuild(context, dockerfile, args, target),deploy.replicas,deploy.resources.limits, GPU reservations- Project name from
-p, thenCOMPOSE_PROJECT_NAME, thenname:, then the folder name
Some things wslc simply can't do yet. When your file uses them, rcompose prints a warning rather than silently ignoring them:
restartpolicies (wslc doesn't support restarts yet)- Bind mounts from Linux host paths like
/var/run/docker.sock. wslc only accepts Windows paths as bind sources, and passing it a Linux path would make it create something likeD:\var\run\docker.sockon your current drive, sorcomposeskips the mount. privileged,cap_add,devices,extra_hosts,secrets,configs,network_modeand a few others
It's a Cargo workspace with four crates:
crates/rcompose-specparses Compose files, handles interpolation and.envloadingcrates/rcompose-enginetalks towslc.exe(and does the retrying)crates/rcompose-coreworks out the start order and runs services in parallel, plus the change detectioncrates/rcompose-cliis the command line and terminal output
There are some ready-to-run Compose files in examples/.
MIT © Ricardo Borges