├── Dockerfile └── README.md /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine AS build 2 | WORKDIR /tmp/linux-src 3 | RUN apk add --no-cache --update ca-certificates libc-dev linux-headers libressl-dev elfutils-dev curl gcc bison flex make musl-dev \ 4 | && KERNELVER=$(uname -r | cut -d '-' -f 1) \ 5 | && curl -fsSL https://www.kernel.org/pub/linux/kernel/v${KERNELVER%%.*}.x/linux-$(uname -r | cut -d '-' -f 1).tar.gz | tar -xzf - --strip-components=1 \ 6 | && make defconfig \ 7 | && ([ ! -f /proc/1/root/proc/config.gz ] || zcat /proc/1/root/proc/config.gz > .config) \ 8 | && printf '%s\n' 'CONFIG_USBIP_CORE=m' 'CONFIG_USBIP_VHCI_HCD=m' 'CONFIG_USBIP_VHCI_HC_PORTS=8' 'CONFIG_USBIP_VHCI_NR_HCS=1' >> .config \ 9 | && make oldconfig modules_prepare \ 10 | && make M=drivers/usb/usbip \ 11 | && mkdir -p /dist \ 12 | && cd drivers/usb/usbip \ 13 | && cp usbip-core.ko vhci-hcd.ko /dist \ 14 | && echo -e '[General]\nAutoFind=0\n' > /dist/.vhui \ 15 | && curl -fsSL https://www.virtualhere.com/sites/default/files/usbclient/vhclientx86_64 -o /dist/vhclientx86_64 \ 16 | && chmod +x /dist/vhclientx86_64 17 | 18 | FROM alpine 19 | COPY --from=build /dist/* /vhclient/ 20 | ENV HOME=/vhclient 21 | WORKDIR /vhclient 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | The VirtualHere client docker image allows you to use USB devices inside a container. 2 | 3 | DockerFile here: https://github.com/virtualhere/docker/blob/master/Dockerfile 4 | 5 | Instructions for using this image: 6 | 7 | (This works under Windows and Mac, for Linux use KVM containers https://github.com/gotoz/runq/) 8 | 9 | 1. Plug the USB device into a purchased virtualhere server. 10 | 2. Run the container like this docker run -td --privileged --name vhclient virtualhere/virtualhere-client:latest ./vhclientx86_64 11 | 3. Now you can use the virtualhere API to connect to the virtualhere server and use a device. 12 | 13 | For example: 14 |
15 | C:\Users\michael\docker-virtualhere-client>docker exec vhclient ./vhclientx86_64 -t "MANUAL HUB ADD,192.168.0.16"
16 | OK
17 | 
18 | C:\Users\michael\docker-virtualhere-client>docker exec vhclient ./vhclientx86_64 -t "LIST"
19 | VirtualHere Client IPC, below are the available devices:
20 | (Value in brackets = address, * = Auto-Use)
21 | 
22 | Desktop Hub (SERVER:7575)
23 |    --> Portable SSD T5 (SERVER.82)
24 |    --> Token JC (SERVER.73) (In-use by: (michael) at 192.168.0.21)
25 |    --> AURA Custom Human interface (SERVER.111)
26 |    --> Corsair Link TM USB Dongle (SERVER.19)
27 | 
28 | Auto-Find currently on
29 | Auto-Use All currently off
30 | Reverse Lookup currently off
31 | Reverse SSL Lookup currently off
32 | VirtualHere Client not running as a service
33 | 
34 | C:\Users\michael\docker-virtualhere-client>docker exec vhclient ./vhclientx86_64 -t "USE,server.111"
35 | OK
36 | 
37 | C:\Users\michael\docker-virtualhere-client>docker exec vhclient lsusb
38 | Bus 001 Device 001: ID 1d6b:0002
39 | Bus 001 Device 002: ID 0b05:1867
40 | 
41 | 
42 | 43 | Notes: 44 | 45 | * The output of the lsusb command confirms the device is attached. (0b05:1867 is the device we used by issuing the USE,server.111 command) 46 | * You would need the normal USB device drivers in your docker container. Eg. usb-storage if you want to use a USB disk, usb-serial if you want to use a serial adapter etc , just like a normal linux setup 47 | 48 | 49 | --------------------------------------------------------------------------------