Skip to content

Commit 4b0ddb5

Browse files
committed
docs: add readme
1 parent 69395c2 commit 4b0ddb5

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed

README.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# usbip-docker
2+
[USB/IP](http://usbip.sourceforge.net/) in Docker
3+
4+
This project provides Docker images to run a USB/IP server and client in Docker containers,
5+
so that USB devices can be used remotely with minimal configuration.
6+
7+
## Server
8+
### Example
9+
```yaml
10+
---
11+
services:
12+
usbip-server:
13+
image: ckware/usbip-server
14+
container_name: usbip-server
15+
init: true
16+
restart: unless-stopped
17+
ports:
18+
- "3240:3240"
19+
environment:
20+
USBIP_DEVICE_IDS: "0000:0000"
21+
volumes:
22+
- "/sys/bus/usb/drivers/usb:/sys/bus/usb/drivers/usb"
23+
- "/sys/bus/usb/drivers/usbip-host:/sys/bus/usb/drivers/usbip-host"
24+
- "/sys/devices/platform:/sys/devices/platform"
25+
```
26+
27+
### Usage
28+
* Enable kernel module `usbip-host` on the host:
29+
30+
`$ sudo sh -c 'modprobe usbip-host && echo usbip-host >>/etc/modules'`
31+
* Create a configuration file `docker-compose.yml` (see the examples and docs for an inspiration)
32+
* Start usbip-server by calling `docker-compose up -d`
33+
34+
### Required Docker configuration options
35+
| Option | Description | Recommendation | Explanation |
36+
| ------------- | ---------------------- | -------------- | ----------- |
37+
| `ports` | Network port | `3240:3240` | Network port for client communication.
38+
| `volumes` | Volumes for USB access | `/sys:/sys` | Access to USB and other devices.
39+
40+
### Environment variables
41+
See _Common environment variables_
42+
43+
## Client
44+
### Example
45+
```yaml
46+
services:
47+
usbip-client:
48+
image: ckware/usbip-client
49+
container_name: usbip-client
50+
init: true
51+
restart: unless-stopped
52+
environment:
53+
USBIP_SERVER: "server-host"
54+
USBIP_DEVICE_IDS: "0000:0000"
55+
privileged: true
56+
```
57+
58+
### Usage
59+
* Enable kernel module `vhci-hcd`:
60+
61+
`$ sudo sh -c 'modprobe vhci-hcd && echo vhci-hcd >>/etc/modules'`
62+
* Create a configuration file `docker-compose.yml` (see the examples and docs for an inspiration)
63+
* Start usbip-client by calling `docker-compose up -d`
64+
65+
### Required Docker configuration options
66+
| Option | Description | Required | Explanation |
67+
| ------------- | --------------- | -------- | ----------- |
68+
| `privileged` | Root privileges | `true` | Root privileges are **required** to write to `/sys/` (see issue [#22825](https://github.com/moby/moby/issues/22825) for details).
69+
70+
### Environment variables
71+
All _Common environment variables_ and:
72+
73+
| Option | Description | Example | Explanation |
74+
| ------------------ | ---------------------- | ------------- | ----------- |
75+
| `USBIP_SERVER` | USB/IP server hostname | `server-host` | Hostname of the USB/IP server
76+
77+
78+
## Common environment variables
79+
| Option | Description | Example | Explanation |
80+
| ------------------ | ---------------------- | --------------------- | ----------- |
81+
| `USBIP_DEVICE_IDS` | List of USB device IDs | `0000:0000,1111:1111` | Comma-separated device id list of managed USB devices (format VID:PID). This option does not support more than one device per ID.
82+
| `USBIP_BUS_IDS` | List of USB bus IDs | `1-1.1,2-2.2` | Comma-separated id list of managed USB devices (format: logical bus ID). This option can be used to use multiple devices with the same device id. The logical bus id of a device will change when it is plugged into a different USB port.
83+
| `USBIP_DEBUG` | Enable debug logging | `true` | When this option is set to any non-empty value, debug logging is enabled.
84+
85+
Only one of `USBIP_DEVICE_IDS` and `USBIP_BUS_IDS` is required; when both variables are given, `USBIP_BUS_IDS` is preferred.
86+
87+
## Pre-requisites
88+
- A linux system with `docker-compose`.
89+
90+
The Docker Compose [documentation](https://docs.docker.com/compose/install/)
91+
contains a comprehensive guide explaining several install options.
92+
On debian-based systems, `docker-compose` may be installed by calling
93+
94+
```shell
95+
$ sudo apt install docker-compose
96+
```

0 commit comments

Comments
 (0)