Cloud Foundry BOSH is a powerful tool that provides a standard for packaging software, deploying it, and especially for managing day-2 operations (including health checks, gradual rollouts, self-healing, and metrics!).
Getting started with BOSH can seem quite daunting as production setups assume you’re using it to manage a bunch of virtual machines on a platform like AWS or vSphere. But for development, there’s BOSH Lite, a lightweight setup crammed into a single VM.
*** BOSH (Typical) ***
┌───────────────────────────────────────────┐
┌─────────────┼────────┐ ┌───────────┐ │
┌──────┼─────┐ │┌───────┼──┼────┐┌─────┼──────────────────┐│
│ ┌────┴───┐ │ ││┌──────▼──▼───┐││┌────▼─────┐┌──────────┐││
│ │BOSH CLI├─┼─┐ ┌───┼┼┤BOSH Director││││BOSH Agent││Deployment│││
│ └────────┘ │ │ │ ││└─────────────┘││└──────────┘└──────────┘││
│Dev Machine │ │ │ ││Virtual Machine││ Virtual Machine ││
└────────────┘ │ │ │└───────────────┘└────────────────────────┘│
│ └───► │
└─────► Platform │
└───────────────────────────────────────────┘
*** BOSH Lite ***
┌────────────────────────────────────────────┐
┌─────────────┼────────┐ ┌───────────┐ │
│ │┌───────┼──┼───────────┼───────────────────┐│
┌──────┼─────┐ ││ │ │ ┌─────┼──────────────────┐││
│ ┌────┴───┐ │ ││┌──────▼──▼───┐ │┌────▼─────┐┌──────────┐│││
│ │BOSH CLI├─┼──┐ │││BOSH Director│ ││BOSH Agent││Deployment││││
│ └────────┘ │ │ ││└──────┬──────┘ │└──────────┘└──────────┘│││
│Dev Machine │ │ ││ └────────► Garden Container │││
└────────────┘ │ ││ └────────────────────────┘││
│ ││ Virtual Machine ││
│ │└──────────────────────────────────────────┘│
└────► Platform │
└────────────────────────────────────────────┘
Unlike a typical setup, BOSH Lite swaps the BOSH Director’s CPI Provider for
Warden (used to interact with Cloud Foundry’s own container runtime engine,
Warden ahem,
Guardian) while the
ephemeral Bootstrap BOSH (via bosh create-env) retains the original
platform’s CPI Proivder. This creates a split-CPI Provider setup which can
seem confusing at first. But as the diagram above shows, it’s actually not too
different!
BOSH Lite can used on top of any BOSH-supported platforms, but more likely than not it’s used on either VirtualBox or Docker. Although Docker is the now-preferred platform for local BOSH development, the VirtualBox support is more feature-complete, better-documented and mature.
This guide will provide steps for spinning up a Windows 11 VirtualBox BOSH environment with the BOSH CLI via Windows Subsystem for Linux 2 (WSL 2).
Unlike prior guides, this also works with the newer WSL 2 mirrored networking mode and limits changes to within WSL 2 and one Hyper-V vSwitch and vEthernet adapter pair.
Most BOSH CPIs (including VirtualBox), and by extension the bosh create-env
command, do not support Windows. Therefore, it’s recommended to run the
command under WSL 2. However:
VBoxManage CLI and passes untransformed
Linux paths for stemcell uploadsbosh CLI on the WSL 2 environmentA word of caution
Following this guide will necessarily alter the security model such that the BOSH Director becomes routable to and from other virtual machines on the host machine rather than just the host operating system. For typical development machines where running VMs are trusted, this should not be an issue.
This is needed to leverage Hyper-V’s vSwitch to expose a network adapter with a routable IP address. Our VirtualBox VMs will attach to this network adapter instead of VirtualBox’s host-only network.
Hyper-V and its sub-features.

Go to “Action” > “Virtual Switch Manager”

Click OK

Tip
When creating a vSwitch in the previous section, a network adapter managed by Hyper-V (called “vEthernet”) is also created. Here, we’ll configure this adapter to be routable.
Right-click on the newly-created network adapter and click “Properties”. It
can be identified by the vSwitch name from the previous section:
vEthernet (<vSwitch Name>).

Note down the network adapter’s name listed under “Connect using”.

Note
Your network adapter name may differ from the example.
Set the IP address and subnet mask.
Note
This example uses the subnet
10.150.250.0/24, though it can be configured to any unused subnet.192.168.56.0/24is not used to avoid conflict with the default VirtualBox host-only network.

VBoxManage CLI to WSL 2In the WSL 2 environment, add the VBoxManage WSL 2 wrapper:
curl -LO https://git.sr.ht/~achrinza/vboxmanage-wsl2-wrapper/blob/main/VBoxManage.sh
chmod +x VBoxManage.sh
sudo mv VBoxManage.sh /usr/local/bin/VBoxManage
Because the networking stack differs from what bosh-deployment covers,
we’ll need to create a new Ops File:
# ./virtualbox-wsl2.yml
- name: /networks/name=default/subnets/0/cloud_properties?
type: replace
value:
type: bridged
# Replace this with your network adapter name:
name: "Hyper-V Virtual Ethernet Adapter #4"
Note
Do not confuse this with the vSwitch name. The network adapter name is autogenerated and should start with
Hyper-V Virtual Ethernet Adapter #.
From there, we can follow the standard VirtualBox
deployment, appending
our new Ops File and altering the internal network variables:
bosh create-env ~/workspace/bosh-deployment/bosh.yml \
--state ./state.json \
-o ~/workspace/bosh-deployment/virtualbox/cpi.yml \
-o ~/workspace/bosh-deployment/virtualbox/outbound-network.yml \
-o ~/workspace/bosh-deployment/bosh-lite.yml \
-o ~/workspace/bosh-deployment/bosh-lite-runc.yml \
-o ~/workspace/bosh-deployment/uaa.yml \
-o ~/workspace/bosh-deployment/credhub.yml \
-o ~/workspace/bosh-deployment/jumpbox-user.yml \
+ -o ./virtualbox-wsl2.yml \
--vars-store ./creds.yml \
-v director_name=bosh-lite \
- -v internal_ip=192.168.56.6 \
- -v internal_gw=192.168.56.1 \
- -v internal_cidr=192.168.56.0/24 \
+ -v internal_ip=10.150.250.6 \
+ -v internal_gw=10.150.250.1 \
+ -v internal_cidr=10.150.250.0/24 \
-v outbound_network_name=NatNetwork
Then, we can alias the BOSH environment:
export BOSH_CLIENT=admin
export BOSH_CLIENT_SECRET="$(bosh int ./creds.yml --path /admin_password)"
bosh alias-env vbox -e 10.150.250.6 --ca-cert <(bosh int ./creds.yml --path /director_ssl/ca)
Now we have a functioning BOSH environment! To start testing out BOSH, we can try the classic ZooKeeper deployment (with some modifications):
bosh -e vbox update-cloud-config ~/workspace/bosh-deployment/warden/cloud-config.yml
# Get the latest `upload-stemcell` command from: https://bosh.io/stemcells/bosh-warden-boshlite-ubuntu-noble
bosh upload-stemcell --sha1 cda735071b3d91349b90ee3309ef8d16cfe2dc74 \
"https://bosh.io/d/stemcells/bosh-warden-boshlite-ubuntu-noble?v=1.460"
bosh -e vbox -d zookeeper deploy <(curl -L https://github.com/achrinzafork/zookeeper-release/raw/b9a3df6abefb2a853738c99c200eaa93892f8f55/manifests/zookeeper.yml)
bosh -e vbox -d zookeeper run-errand smoke-tests
- Rifa Achrinza