Type: unix-char¶
Note
The unix-char device type is supported for containers.
It supports hotplugging.
Unix character devices make the specified character device appear as a device in the container (under /dev).
You can read from the device and write to it.
Device options¶
unix-char devices have the following device options:
| Key: | required |
| Type: | bool |
| Default: |
|
See Hotplugging for more information.
Configuration examples¶
Add a unix-char device to a container by specifying its source and path:
lxc config device add <instance_name> <device_name> unix-char source=<path_on_host> path=<path_on_instance>
If you want to use the same path on the container as on the host, you can omit the source option:
lxc config device add <instance_name> <device_name> unix-char path=<path_to_the_device>
See Configure devices for more information.
Hotplugging¶
Hotplugging is enabled if you set required=false and specify the source option for the device.
In this case, the device is automatically passed into the container when it appears on the host, even after the container starts. If the device disappears from the host system, it is removed from the container as well.