r/docker • u/Capital_Birthday_654 • 23d ago
usb passthrough for esp32 on macos docker, anyone got it working?
so i recently moved from linux bazzite to an m2 macbook air and i've been trying to get my esp32 boards working inside docker devcontainers on vscode
the problem is macos can see my esp32-s3 just fine, esptool works and everything through /dev/cu.usbmodem but inside the devcontainer i can't access the usb at all
i use tool and script inside the container and i want them to be able to build, flash, read flash and monitor serial logs on multiple esp32 boards without me having to do everything manually. ideally jtag too. on bazzite this was literally just passing the device to docker and it worked
i've been looking around and found usb/ip, virtualhere, colima with qemu and orbstack. orbstack seems promising but it's proprietary and i'm kinda worried it'll stop being free someday. i'd prefer something open source if possible
i don't really wanna set up another full linux vm just for usb either, kinda defeats the point of using devcontainers in the first place
has anyone actually managed to get proper usb passthrough working on apple silicon? especially with esp32-s3 native usb serial/jtag? i'm looking for something that can handle flashing, resetting and monitoring repeatedly without randomly breaking
would appreciate hearing what actually works for you guys cause i've been going in circles with this for a while now
1
u/Capital_Birthday_654 23d ago
update: thanks both. tried the rfc2217 bridge first but my boards are s3 and p4 on the native usb port (usb-serial/jtag) and esptool says remote ports dont support that properly, plus no jtag, so it was flaky for me. orbstack looked good too but its paid for commercial use and i didnt want to get locked in. ended up trying kiri (github.com/libracoder/kiri), open source apache-2.0 and it has usb passthrough in beta now. you click attach in the app, the s3 shows up as /dev/ttyACM0 in the vm, then i just added -v /dev:/dev and --device-cgroup-rule=c 166:* rmw to my devcontainer runArgs and esptool chip_id works straight from inside the container. still beta tho, the board detaches by itself after like 8 min idle so you have to hit attach again, already opened an issue for that. but honestly first thing that actually worked after a whole day of messing around
2
u/ymgymg 23d ago
You can skip passthrough for the serial part. Run esp_rfc2217_server.py on the mac against /dev/cu.usbmodem and point esptool in the container at rfc2217://host.docker.internal:4000, flashing and monitoring both work over that, though JTAG won't.