VirtualHere USB Server in a minimal Alpine image to share USB devices over the network
1.9K
A minimal Alpine-based Docker image that runs the VirtualHere USB Server, letting you share USB devices attached to the Docker host over the network.
The VirtualHere server binary is downloaded when the image is built and baked into the image. On every container start the entrypoint script writes any environment variables you provide into /data/config.ini and starts the server.
docker run -d \
--name virtualhere \
--restart unless-stopped \
--privileged \
-p 7575:7575/tcp \
-p 5353:5353/udp \
-v /path/on/host/data:/data \
-e SERVERNAME=MyVirtualHere \
andrewagner86/virtualhere:latest
--privileged (or at least --device=/dev/bus/usb) is required so the container can access the host's USB devices.
Image tags are the version of the contained VirtualHere USB Server, e.g. 4.8.8, 4.8, 4 and latest. To pin a VirtualHere version, use the full version tag.
During the build, the downloaded binary is verified against the SHA1 hash recorded for that version, so a tag always contains exactly the VirtualHere binary of its version.
services:
virtualhere:
image: andrewagner86/virtualhere:latest
container_name: virtualhere
restart: unless-stopped
privileged: true
ports:
- "7575:7575/tcp"
- "5353:5353/udp"
volumes:
- ./data:/data
environment:
- SERVERNAME=MyVirtualHere
/data is used to persist config.ini across container restarts/updates. Mount a host directory or named volume there.
| Port | Protocol | Purpose |
|---|---|---|
| 7575 | TCP | Client control and USB device data |
| 5353 | UDP | Bonjour/Avahi auto-discovery |
All variables below are optional. When set, their value is written into the corresponding key in /data/config.ini before the server starts (existing values in config.ini are preserved if a variable is not set). See the official VirtualHere server configuration reference for full, authoritative details on each setting.
| Variable | config.ini key | Description |
|---|---|---|
SERVERNAME | ServerName | Name of the server shown to VirtualHere clients. |
LICENSE | License | VirtualHere Pro license key. |
DEVICENICKNAMES | DeviceNicknames | Custom nicknames for specific USB devices. |
USEAVAHI | UseAVAHI | Enable (1) or disable (0) Bonjour/Avahi auto-discovery. |
HOSTNAME | Hostname | Hostname advertised by the server. |
COMPRESSIONLIMIT | CompressionLimit | Packet size threshold (bytes) above which USB traffic is compressed. |
IGNOREDDEVICES | IgnoredDevices | USB devices to exclude from sharing. |
IGNOREDBUSES | IgnoredBuses | USB buses to exclude from sharing. |
ALLOWEDDEVICES | AllowedDevices | Whitelist restricting sharing to only these devices. |
AUTOATTACHTOKERNEL | AutoAttachToKernel | Whether devices are reattached to the host kernel driver when not in use by a client. |
CLAIMPORTS | ClaimPorts | Whether entire USB ports are claimed, even without a matching device attached. |
PINGINTERVAL | PingInterval | Interval (seconds) for client keep-alive pings. |
PINGTIMEOUT | PingTimeout | Timeout (seconds) for a ping response before considering a client disconnected. |
CONTROLTIMEOUT | ControlTimeout | Timeout (seconds) for USB control transfers. |
USEAVAHISERVICEFILE | UseAvahiServiceFile | Whether to use a dedicated Avahi service file for discovery. |
REVERSECLIENTS | ReverseClients | Addresses of clients the server should reverse-connect to (useful when the server is behind NAT/firewall). |
REVERSECLIENTSRETRYPERIOD | ReverseClientsRetryPeriod | Retry period (seconds) for reverse client connections. |
CLIENTIDMAP | ClientIdMap | Maps client identifiers to friendly names. |
HIDECLIENTINFO | HideClientInfo | Hides client IP/hostname info from the device list. |
NETWORKINTERFACE | NetworkInterface | Network interface the server should bind to. |
CLIENTAUTHORIZATION | ClientAuthorization | Path to a script/executable invoked to authorize connecting clients. |
CLIENTDEAUTHORIZATION | ClientDeauthorization | Path to a script/executable invoked when a client disconnects. |
SSLCERT | SSLCert | Path to an SSL certificate for encrypted client connections. |
SSLUSECLIENTCERTS | SSLUseClientCerts | Whether to require client certificates (mutual TLS). |
SSLCAFILE | SSLCAFile | CA file used to validate client certificates. |
At build time the VirtualHere binary matching the target platform is picked:
linux/amd64 → vhusbdx86_64linux/386 → vhusbdi386linux/arm64 → vhusbdarm64linux/arm/v7 / linux/arm/v6 → vhusbdarmThe image itself is built for linux/amd64, linux/386, linux/arm64, linux/arm/v7 and linux/arm/v6.
VirtualHere also provides MIPS binaries (vhusbdmips, vhusbdmipsel), but there is no official Alpine base image for MIPS, so this image can't be built for those platforms.
The files used to build this image are licensed under the MIT License. VirtualHere itself is a separate, third-party product with its own license terms.
Content type
Image
Digest
sha256:239dc84a6…
Size
4.6 MB
Last updated
11 days ago
docker pull andrewagner86/virtualhere