services: relay: build: context: . dockerfile: Dockerfile image: usb-server-relay ports: - "8543:8443" restart: unless-stopped healthcheck: test: ["CMD", "wget", "-q", "--spider", "http://localhost:8443/health"] interval: 30s timeout: 5s retries: 3 # USB client. Commented out by default because it only works on a Linux # host and needs privileged access — enable it deliberately. # # Requirements on the host: # - Linux (containers share the host kernel; on macOS and Windows Docker # runs in a VM with no access to the USB hardware) # - "sudo modprobe vhci-hcd" for use mode # - a config with the three tokens in ./client-config/ # # client: # build: # context: . # dockerfile: Dockerfile.client # image: usb-server-client # command: ["both", "--config", "/config/config.json"] # restart: unless-stopped # # Needed to detach kernel drivers and rebind them afterwards. # privileged: true # # host networking keeps direct peer connections working: in bridge mode # # the addresses the client advertises are container-internal and # # unreachable, so every tunnel would fall back to the relay. # network_mode: host # volumes: # - ./client-config:/config # - /dev/bus/usb:/dev/bus/usb # - /sys/bus/usb:/sys/bus/usb # # Only needed for use mode, to attach remote devices: # - /sys/devices/platform/vhci_hcd.0:/sys/devices/platform/vhci_hcd.0 # environment: # - USBSRV_DEBUG=0